package entities import ( "gorm.io/gorm" "sorbet/pkg/db" "time" ) // Feature 栏目表 type Feature struct { ID uint `json:"id" xml:"id" gorm:"primaryKey;not null;comment:栏目编号"` Title string `json:"title" xml:"title" gorm:"size:25;not null;uniqueIndex;comment:栏目名称"` Intro string `json:"intro" xml:"intro" gorm:"comment:栏目简介"` Icon string `json:"icon" xml:"icon" gorm:"comment:栏目图标"` Sort int32 `json:"sort" xml:"sort" gorm:"default:0;comment:排序"` Version db.Version `json:"-" xml:"-" gorm:"comment:乐观锁"` CreatedAt time.Time `json:"create_time" xml:"create_time" gorm:"<-:false;comment:创建时间"` UpdatedAt time.Time `json:"update_time" xml:"update_time" gorm:"<-:false;comment:更新时间"` DeletedAt gorm.DeletedAt `json:"delete_time" xml:"delete_time" gorm:"comment:删除时间"` Config *FeatureConfig `json:"config" xml:"config"` Categories []*FeatureCategory `json:"categories" xml:"categories"` Contents []*FeatureContent `json:"contents" xml:"contents"` } // AfterDelete 将在对应的条件数据成功从数据库删除之后执行 // todo(hupeh): 是否支持软删除 func (f *Feature) AfterDelete(tx *gorm.DB) error { return nil }