baseModel.go 412 B

12345678910111213
  1. package model
  2. import (
  3. "gorm.io/gorm"
  4. "time"
  5. )
  6. type BaseModel struct {
  7. ID int `json:"id" form:"id" gorm:"primaryKey"`
  8. CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
  9. UpdateAt time.Time `json:"-" gorm:"autoUpdateTime"`
  10. DeletedAt gorm.DeletedAt `json:"-" gorm:"column:delete_at"`
  11. }