time_base.go 362 B

12345678910111213
  1. package base
  2. import "time"
  3. type TimeBase struct {
  4. CreateTime time.Time `gorm:"autoCreateTime;column:create_time" json:"create_time"` //创建时间
  5. ModifyTime time.Time `gorm:"autoUpdateTime:milli;column:modify_time" json:"modify_time"` //最后更新时间
  6. }
  7. func (item *TimeBase) Set() {
  8. item.CreateTime = time.Now()
  9. item.ModifyTime = time.Now()
  10. }