简化数据库查询代码

This commit is contained in:
GoEdgeLab
2020-12-09 20:44:05 +08:00
parent f263d83700
commit 142fd8651b
56 changed files with 164 additions and 141 deletions

View File

@@ -50,7 +50,7 @@ func (this *SysLockerDAO) Lock(key string, timeout int64) (bool, error) {
op.Key = key
op.TimeoutAt = time.Now().Unix() + timeout
op.Version = 1
_, err := this.Save(op)
err := this.Save(op)
if err != nil {
maxErrors--
if maxErrors < 0 {
@@ -73,7 +73,7 @@ func (this *SysLockerDAO) Lock(key string, timeout int64) (bool, error) {
op.Id = locker.Id
op.Version = locker.Version + 1
op.TimeoutAt = time.Now().Unix() + timeout
_, err = this.Save(op)
err = this.Save(op)
if err != nil {
maxErrors--
if maxErrors < 0 {