goProject/trunk/framework/sqlAsyncMgr/statisticModel.go
皮蛋13361098506 1b77f62820 初始化项目
2025-01-06 16:01:02 +08:00

41 lines
687 B
Go

package sqlAsyncMgr
import (
"sync"
)
// 标识内容模型对象
type StatisticModel struct {
// 锁对象
m sync.Mutex
// 标识
IdentityId string
// 待同步的数量
Count int32
}
// AddCount 添加指定数量
func (this *StatisticModel) AddCount(addcount int32) {
this.m.Lock()
defer this.m.Unlock()
this.Count = this.Count + addcount
}
// ReduceCount 添加指定数量
func (this *StatisticModel) ReduceCount(recount int32) {
this.m.Lock()
defer this.m.Unlock()
this.Count = this.Count - recount
}
// newStatisticModel 创建新StatisticModel对象
func newStatisticModel(ident string) *StatisticModel {
return &StatisticModel{
IdentityId: ident,
}
}