package model import ( "time" "gorm.io/gorm" ) // News 对应 cy_news 表 type News struct { ID uint `gorm:"primaryKey" json:"id"` CategoryID uint `gorm:"column:category_id;not null" json:"category_id"` Title string `gorm:"column:title;size:255;not null" json:"title"` Author string `gorm:"column:author;size:50" json:"author,omitempty"` CoverImage string `gorm:"column:cover_image;size:255" json:"cover_image,omitempty"` Summary string `gorm:"column:summary;size:255" json:"summary,omitempty"` Content string `gorm:"column:content;type:longtext;not null" json:"content"` Status int8 `gorm:"column:status;default:1;not null" json:"status"` IsRecommend int8 `gorm:"column:is_recommend;default:0;not null" json:"is_recommend"` IsTop int8 `gorm:"column:is_top;default:0;not null" json:"is_top"` Views int `gorm:"column:views;default:0;not null" json:"views"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` DeleteTime gorm.DeletedAt `gorm:"column:delete_time;index" json:"delete_time,omitempty"` } func (News) TableName() string { return "cy_news" }