优化:仅在 debug 模式下显示 SQL 日志
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"kenaito-conf/server/internal/util"
|
"kenaito-conf/server/internal/util"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
)
|
)
|
||||||
@@ -22,7 +23,10 @@ func Init() error {
|
|||||||
}
|
}
|
||||||
Engine.SetMaxOpenConns(20)
|
Engine.SetMaxOpenConns(20)
|
||||||
Engine.SetMaxIdleConns(5)
|
Engine.SetMaxIdleConns(5)
|
||||||
|
|
||||||
|
if config.Cfg.Server.Mode == gin.DebugMode {
|
||||||
Engine.ShowSQL(true)
|
Engine.ShowSQL(true)
|
||||||
|
}
|
||||||
|
|
||||||
// sync table structures
|
// sync table structures
|
||||||
if err := Engine.Sync2(
|
if err := Engine.Sync2(
|
||||||
|
|||||||
Reference in New Issue
Block a user