YouChuKoffee/app/models/usersmodel/users.go

42 lines
863 B
Go
Raw Normal View History

2024-06-17 16:29:39 +08:00
package usersmodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *UsersModel
)
// 实体
type Users struct {
2024-06-25 10:12:48 +08:00
Id string `xorm:"'id' UNSIGNED INT pk autoincr"`
CustNo string `xorm:"'custNo' varchar(128)"`
Status string `xorm:"'status' UNSIGNED TINYINT"`
CreateTime time.Time `xorm:"'create_time' datetime"`
UpdateTime time.Time `xorm:"'update_time' datetime"`
Deleted time.Time `xorm:"'Deleted' datetime"`
2024-06-17 16:29:39 +08:00
}
// 表名
func (m *Users) TableName() string {
return "Users"
}
// 私有化防止被外部new
type UsersModel struct {
db.Model //组合基础Model集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *UsersModel {
once.Do(func() {
m = new(UsersModel)
//m.DiName = "" //设置数据库实例连接默认db.SingletonMain
})
return m
}