45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package crondbmodel
|
||
|
||
import (
|
||
"github.com/qit-team/snow-core/db"
|
||
"sync"
|
||
"time"
|
||
)
|
||
|
||
var (
|
||
once sync.Once
|
||
m *CronReportLogsModel
|
||
)
|
||
|
||
// 实体
|
||
type CronReportLogs struct {
|
||
ReportId int64 `xorm:"'report_id' UNSIGNED INT"`
|
||
FuncLogId int64 `xorm:"'func_log_id' INT"`
|
||
CmdId int64 `xorm:"'cmd_id' INT"`
|
||
UserId string `xorm:"'user_id' varchar(100)"`
|
||
Data string `xorm:"'data' json"`
|
||
FailReason string `xorm:"'fail_reason' varchar(200)"`
|
||
CreateTime time.Time `xorm:"'create_time' datetime"`
|
||
UpdateTime time.Time `xorm:"'update_time' timestamp"`
|
||
Status int `xorm:"'status' tinyint"`
|
||
}
|
||
|
||
// 表名
|
||
func (m *CronReportLogs) TableName() string {
|
||
return "cron_report_logs"
|
||
}
|
||
|
||
// 私有化,防止被外部new
|
||
type CronReportLogsModel struct {
|
||
db.Model //组合基础Model,集成基础Model的属性和方法
|
||
}
|
||
|
||
// 单例模式
|
||
func GetInstance() *CronReportLogsModel {
|
||
once.Do(func() {
|
||
m = new(CronReportLogsModel)
|
||
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
||
})
|
||
return m
|
||
}
|