优化自增锁性能

This commit is contained in:
GoEdgeLab
2023-07-04 22:02:17 +08:00
parent 1c695ebf93
commit 93806063da
4 changed files with 58 additions and 4 deletions

View File

@@ -97,7 +97,13 @@ func (this *Setup) Run() error {
}
for _, db := range config.DBs {
// 可以同时运行多条语句
db.Dsn += "&multiStatements=true"
if !strings.Contains(db.Dsn, "multiStatements=") {
if strings.Contains(db.Dsn, "?") {
db.Dsn += "&multiStatements=true"
} else {
db.Dsn += "?multiStatements=true"
}
}
}
dbConfig, ok := config.DBs[Tea.Env]
if !ok {