mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-11 13:53:35 +08:00
减少在自增锁中生成的sql statements
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user