package dbFacade import ( "go.mongodb.org/mongo-driver/v2/mongo" ) type Table interface { TableName() string // 表名 PrimaryValue() any // !!!这是主键值,必需是单表唯一,不行就用唯一ID EnableQueue() bool // 是否启动保存队列 FlushUpdateTime(now int64) // 刷新更新时间 CheckField() // 初始化或保存时检查字段空值 Indexes() []mongo.IndexModel // 构建索引列表 } type TableBase struct { UpdateTime int64 `bson:"UpdateTime,omitempty"` // 更新时间 } func (p *TableBase) FlushUpdateTime(now int64) { p.UpdateTime = now } func (p *TableBase) EnableQueue() bool { return true } func (p *TableBase) CheckField() { } func (p *TableBase) Indexes() []mongo.IndexModel { return nil }