package model import ( "time" "gorm.io/gorm" ) // BaseModel 基础模型 type BaseModel struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` } // BaseModelWithTime 带时间戳的模型 type BaseModelWithTime struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `gorm:"type:datetime" json:"created_at"` UpdatedAt time.Time `gorm:"type:datetime" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` }