package paychannelmodel

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

var (
	once sync.Once
	m    *PayChannelModel
)

// 实体
type PayChannel struct {
	Id          int64
	PayName     string    `xorm:"'pay_name' varchar(128)"`
	MerchantId  int64     `xorm:"'merchant_id' bigint(20)"`
	ChannelType int       `xorm:"'channel_type' int(11)"`
	AppId       string    `xorm:"'app_id' varchar(255)"`
	ExtJson     string    `xorm:"'ext_json' JSON"`
	ExpireTime  time.Time `xorm:"'expire_time' datetime"`
	CreateTime  time.Time `xorm:"'create_time' datetime created"`
	UpdateTime  time.Time `xorm:"'update_time' timestamp updated"`
	DeleteTime  time.Time `xorm:"'delete_time' timestamp deleted"`
}

// 表名
func (m *PayChannel) TableName() string {
	return "pay_channel"
}

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

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