Some checks failed
CI / Lint + Build (push) Has been cancelled
变更模型: - Post: 嵌入 BaseModel,移除手动 ID/CreatedAt/UpdatedAt/DeletedAt - Comment: 嵌入 BaseModel,保留 is_deleted 自定义软删除 - Announcement: 嵌入 BaseModel - Category: 嵌入 BaseModel - Folder + FolderItem: 嵌入 BaseModel - CommunityFund: primaryKey → primarykey (统一小写)
16 lines
542 B
Go
16 lines
542 B
Go
package model
|
|
|
|
// Category 文章分类(两级树形结构)
|
|
type Category struct {
|
|
BaseModel
|
|
|
|
Name string `gorm:"type:varchar(50);not null" json:"name"`
|
|
Slug string `gorm:"type:varchar(50);not null;uniqueIndex" json:"slug"`
|
|
Description string `gorm:"type:varchar(200);default:''" json:"description,omitempty"`
|
|
ParentID *uint `gorm:"index" json:"parent_id,omitempty"`
|
|
Sort int `gorm:"default:0" json:"sort"`
|
|
|
|
// 非 DB 字段(树形填充)
|
|
Children []Category `gorm:"-" json:"children,omitempty"`
|
|
}
|