master
Evan Chen 2022-01-03 13:08:09 +08:00
parent df967ca290
commit c6038a8f0c
1 changed files with 4 additions and 1 deletions

5
db.go
View File

@ -18,9 +18,12 @@ func connectToDB() {
DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT, DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT,
) )
config := &gorm.Config{ config := &gorm.Config{
Logger: logger.Default, Logger: logger.Discard,
SkipDefaultTransaction: true, SkipDefaultTransaction: true,
} }
if flagDev {
config.Logger = logger.Default
}
for { for {
db, err := gorm.Open(postgres.New(postgres.Config{ db, err := gorm.Open(postgres.New(postgres.Config{
DSN: dsn, // data source name DSN: dsn, // data source name