package model import "time" // Post 博客文章,表名 sundynix_post(NamingStrategy 统一加前缀)。 // Content 为 Markdown 原文,渲染交给前端;PublishedAt 为空即草稿。 type Post struct { BaseModel Slug string `gorm:"uniqueIndex;size:128" json:"slug"` Title string `gorm:"size:256" json:"title"` Category string `gorm:"size:64;index" json:"category"` Summary string `gorm:"size:512" json:"summary"` Content string `gorm:"type:text" json:"content,omitempty"` PublishedAt *time.Time `gorm:"index" json:"published_at"` } // PostListItem 列表项投影,不带正文。 type PostListItem struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Category string `json:"category"` Summary string `json:"summary"` PublishedAt *time.Time `json:"published_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }