减少在自增锁中生成的sql statements

This commit is contained in:
刘祥超
2023-07-04 14:42:14 +08:00
parent 3f21b3148e
commit c20accbf58
2 changed files with 17 additions and 0 deletions

View File

@@ -138,6 +138,7 @@ func (this *SysLockerDAO) Increase(tx *dbs.Tx, key string, defaultValue int64) (
return result, err
}
err := this.Query(tx).
Reuse(false). // no need to prepare statement in every transaction
InsertOrUpdateQuickly(maps.Map{
"key": key,
"version": defaultValue,
@@ -148,6 +149,7 @@ func (this *SysLockerDAO) Increase(tx *dbs.Tx, key string, defaultValue int64) (
return 0, err
}
return this.Query(tx).
Reuse(false). // no need to prepare statement in every transaction
Attr("key", key).
Result("version").
FindInt64Col(0)