feat: cmd model
This commit is contained in:
parent
302740186c
commit
b6798ca73e
|
@ -0,0 +1,54 @@
|
|||
package croncmdmodel
|
||||
|
||||
import (
|
||||
"github.com/qit-team/snow-core/db"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
once sync.Once
|
||||
m *CronCmdModel
|
||||
)
|
||||
|
||||
// 实体
|
||||
type CronCmd struct {
|
||||
CmdId string `xorm:"'cmd_id' UNSIGNED INT"`
|
||||
CmdName string `xorm:"'cmd_name' varchar(20)"`
|
||||
UserIds string `xorm:"'user_ids' varchar(50)"`
|
||||
EntryId int `xorm:"'entry_id' int(10)"`
|
||||
ReadDbId int `xorm:"'read_db_id' int(10)"`
|
||||
WriteDbId int `xorm:"'write_db_id' int(11)"`
|
||||
ExecuteType int `xorm:"'execute_type' TINYINT"`
|
||||
ExecuteRead string `xorm:"'execute_read' TEXT"`
|
||||
ExecuteWrite string `xorm:"'execute_write' TEXT"`
|
||||
Cron string `xorm:"'cron' varchar(64)"`
|
||||
MatchJson string `xorm:"'match_json' JSON"`
|
||||
SendTimeType int `xorm:"'send_time_type' TINYINT"`
|
||||
SendLimit int `xorm:"'send_limit' SMALLINT"`
|
||||
ReportChannelId int `xorm:"'report_channel_id' int(11)"`
|
||||
CreateTime time.Time `xorm:"'create_time' datetime"`
|
||||
UpdateTime time.Time `xorm:"'update_time' timestamp"`
|
||||
Status int `xorm:"'status' TINYINT"`
|
||||
FailReason string `xorm:"'fail_reason' varchar(200)"`
|
||||
DeletedTime time.Time `xorm:"'deleted_time' datetime"`
|
||||
}
|
||||
|
||||
// 表名
|
||||
func (m *CronCmd) TableName() string {
|
||||
return "cron_cmd"
|
||||
}
|
||||
|
||||
// 私有化,防止被外部new
|
||||
type CronCmdModel struct {
|
||||
db.Model //组合基础Model,集成基础Model的属性和方法
|
||||
}
|
||||
|
||||
// 单例模式
|
||||
func GetInstance() *CronCmdModel {
|
||||
once.Do(func() {
|
||||
m = new(CronCmdModel)
|
||||
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
||||
})
|
||||
return m
|
||||
}
|
Loading…
Reference in New Issue