fix pgsql return error to panic

This commit is contained in:
ByteZhou-2018
2025-03-18 21:57:51 +08:00
parent 06ec433b4e
commit 4964518486

View File

@@ -31,7 +31,7 @@ func initPgSqlDatabase(p config.Pgsql) *gorm.DB {
PreferSimpleProtocol: false,
}
if db, err := gorm.Open(postgres.New(pgsqlConfig), internal.Gorm.Config(p.Prefix, p.Singular)); err != nil {
return nil
panic(err)
} else {
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(p.MaxIdleConns)