package cronfunclogsmodel import ( "github.com/qit-team/snow-core/db" "sync" "time" ) var ( once sync.Once m *CronFuncLogsModel ) // 实体 type CronFuncLogs struct { LogId int64 `xorm:"'log_id' UNSIGNED INT"` CmdId int64 `xorm:"'cmd_id' INT"` ReadExecute string `xorm:"'read_execute' json"` WriteExecute string `xorm:"'write_execute' text"` FailReason string `xorm:"'fail_reason' text"` CreateTime *time.Time `xorm:"'create_time' datetime"` UpdateTime *time.Time `xorm:"'update_time' timestamp"` Status int `xorm:"'status' tinyint"` } // 表名 func (m *CronFuncLogs) TableName() string { return "cron_func_logs" } // 私有化,防止被外部new type CronFuncLogsModel struct { db.Model //组合基础Model,集成基础Model的属性和方法 } // 单例模式 func GetInstance() *CronFuncLogsModel { once.Do(func() { m = new(CronFuncLogsModel) //m.DiName = "" //设置数据库实例连接,默认db.SingletonMain }) return m }