feat 忽略找不到数据库记录的报错

This commit is contained in:
timerzz 2024-09-03 15:21:54 +08:00
parent 07cb2d39ed
commit 8dfcdb4086

View File

@ -32,9 +32,10 @@ func InitDefaultDatabase() (*gorm.DB, error) {
db.Logger = logger.New(
log.New(os.Stdout, "\r\n", log.LstdFlags),
logger.Config{
SlowThreshold: time.Second,
LogLevel: logger.Warn,
Colorful: true,
SlowThreshold: time.Second,
LogLevel: logger.Warn,
Colorful: true,
IgnoreRecordNotFoundError: true,
},
)
return db, nil