Files
go_blog/models/content.go

28 lines
1.2 KiB
Go
Raw Permalink Normal View History

2024-01-23 18:29:13 +08:00
package models
2026-02-12 13:48:35 +08:00
// Content 内容模型(文章/页面)
2024-01-23 18:29:13 +08:00
type Content struct {
Cid int32 `gorm:"column:cid;primaryKey;autoIncrement:true" json:"cid"`
Title string `gorm:"column:title" json:"title"`
Slug string `gorm:"column:slug" json:"slug"`
Created int32 `gorm:"column:created" json:"created"`
Modified int32 `gorm:"column:modified" json:"modified"`
Text string `gorm:"column:text" json:"text"`
Order_ int32 `gorm:"column:order" json:"order"`
AuthorID int32 `gorm:"column:authorId" json:"authorId"`
Template string `gorm:"column:template" json:"template"`
Type string `gorm:"column:type;default:post" json:"type"`
Status string `gorm:"column:status;default:publish" json:"status"`
Password string `gorm:"column:password" json:"password"`
CommentsNum int32 `gorm:"column:commentsNum" json:"commentsNum"`
AllowComment string `gorm:"column:allowComment;default:0" json:"allowComment"`
AllowPing string `gorm:"column:allowPing;default:0" json:"allowPing"`
AllowFeed string `gorm:"column:allowFeed;default:0" json:"allowFeed"`
Parent int32 `gorm:"column:parent" json:"parent"`
}
2026-02-12 13:48:35 +08:00
// TableName 指定表名
2024-01-23 18:29:13 +08:00
func (*Content) TableName() string {
2026-02-12 13:48:35 +08:00
return "contents"
2024-01-23 18:29:13 +08:00
}