feat 忽略找不到数据库记录的报错
This commit is contained in:
parent
07cb2d39ed
commit
8dfcdb4086
@ -32,9 +32,10 @@ func InitDefaultDatabase() (*gorm.DB, error) {
|
|||||||
db.Logger = logger.New(
|
db.Logger = logger.New(
|
||||||
log.New(os.Stdout, "\r\n", log.LstdFlags),
|
log.New(os.Stdout, "\r\n", log.LstdFlags),
|
||||||
logger.Config{
|
logger.Config{
|
||||||
SlowThreshold: time.Second,
|
SlowThreshold: time.Second,
|
||||||
LogLevel: logger.Warn,
|
LogLevel: logger.Warn,
|
||||||
Colorful: true,
|
Colorful: true,
|
||||||
|
IgnoreRecordNotFoundError: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return db, nil
|
return db, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user