package base import "time" type TimeBase struct { CreateTime time.Time `gorm:"autoCreateTime;column:create_time" json:"create_time" description:"创建时间"` ModifyTime time.Time `gorm:"autoUpdateTime:milli;column:modify_time" json:"modify_time" description:"最后更新时间"` } func (item *TimeBase) Set() { item.CreateTime = time.Now() item.ModifyTime = time.Now() }