package cool import ( "github.com/gogf/gf/v2/os/gtime" ) type IModel interface { TableName() string GroupName() string } type UserModel interface { GetData() string SetData(data string) TableName() string GroupName() string } type Model struct { ID uint `gorm:"primaryKey" json:"id"` CreateTime *gtime.Time ` gorm:"column:createTime;not null;index,priority:1;autoCreateTime:nano;comment:创建时间" json:"createTime"` // 创建时间 UpdateTime *gtime.Time `orm:"autoUpdateTime=true" gorm:"column:updateTime;not null;index,priority:1;autoUpdateTime:nano;comment:更新时间" json:"updateTime"` // 更新时间 DeletedAt *gtime.Time `gorm:"index" json:"deletedAt"` } // 返回表名 func (m *Model) TableName() string { return "this_table_should_not_exist" } // 返回分组名 func (m *Model) GroupName() string { return "default" } func NewModel() *Model { return &Model{} }