优化自增锁性能

This commit is contained in:
刘祥超
2023-07-04 22:02:17 +08:00
parent 9f564a4739
commit 58a84083ae
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 {