// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. package model import ( "time" "git.hlsq.asia/mmorpg/service-common/utils" "gorm.io/gorm" ) const TableNameUser = "users" // User mapped from table type User struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号 Name string `gorm:"column:name;not null" json:"name"` Phone string `gorm:"column:phone" json:"phone"` WxUnionID string `gorm:"column:wx_union_id;comment:微信用户唯一标识" json:"wx_union_id"` // 微信用户唯一标识 WxMiniOpenID string `gorm:"column:wx_mini_open_id;comment:微信小程序的openID" json:"wx_mini_open_id"` // 微信小程序的openID CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"` } // TableName User's table name func (*User) TableName() string { return TableNameUser } // Auto sn func (m *User) BeforeCreate(_ *gorm.DB) error { if m.Sn == 0 { m.Sn = utils.SnowflakeInstance().Generate().Int64() } return nil }