优化:仅在 debug 模式下显示 SQL 日志

This commit is contained in:
2026-05-23 21:01:16 +08:00
parent c0aa5b6806
commit 1d94dbf8e1
+4
View File
@@ -6,6 +6,7 @@ import (
"kenaito-conf/server/internal/util"
"time"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
"xorm.io/xorm"
)
@@ -22,7 +23,10 @@ func Init() error {
}
Engine.SetMaxOpenConns(20)
Engine.SetMaxIdleConns(5)
if config.Cfg.Server.Mode == gin.DebugMode {
Engine.ShowSQL(true)
}
// sync table structures
if err := Engine.Sync2(