package cronreportchannelmodel

import (
	"github.com/qit-team/snow-core/db"
	"sync"
	"time"
)

var (
	once sync.Once
	m    *CronReportChannelModel
)

// 实体
type CronReportChannel struct {
	ReportChannelId int       `xorm:"'report_channel_id' UNSIGNED INT pk autoincr"`
	ClientKey       string    `xorm:"'client_key' varchar(20)"`
	ClientSecret    string    `xorm:"'client_secret' varchar(50)"`
	Config          string    `xorm:"'config' JSON"`
	Status          int       `xorm:"'status' TINYINT"`
	CreateTime      time.Time `xorm:"'create_time' created timestamp"`
	UpdateTime      time.Time `xorm:"'update_time' updated timestamp"`
	DeletedTime     time.Time `xorm:"'deleted_time' deleted datetime"`
}

// 表名
func (m *CronReportChannel) TableName() string {
	return "cron_report_channel"
}

// 私有化,防止被外部new
type CronReportChannelModel struct {
	db.Model //组合基础Model,集成基础Model的属性和方法
}

// 单例模式
func GetInstance() *CronReportChannelModel {
	once.Do(func() {
		m = new(CronReportChannelModel)
		//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
	})
	return m
}