package userinfomodel

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

var (
	once sync.Once
	m    *UserInfoModel
)

// 实体
type UserInfo struct {
	Id                         int       `xorm:"'Id' int(0)"`
	Clientuniqueidentification string    `xorm:"'ClientUniqueIdentification' varchar(255)"`
	Mobile                     string    `xorm:"'Mobile' varchar(13)"`
	Status                     int       `xorm:"'Status' TINYINT"`
	Lastupdatetime             time.Time `xorm:"'LastUpdateTime' datetime"`
	Createtime                 time.Time `xorm:"'CreateTime' datetime"`
}

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

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

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