model.go 428 B

12345678910111213
  1. package models
  2. import "time"
  3. // BaseModel 基础模型
  4. type BaseModel struct {
  5. ID uint `gorm:"column:id;primaryKey;autoIncrement;" json:"id,omitempty"` // 主键ID
  6. }
  7. type CommonTimestampsField struct {
  8. CreatedAt time.Time `gorm:"column:created_at;index;" json:"created_at,omitempty"` // 创建时间
  9. UpdatedAt time.Time `gorm:"column:updated_at;index;" json:"updated_at,omitempty"` // 更新时间
  10. }