24 lines
1.2 KiB
Go
24 lines
1.2 KiB
Go
|
|
package model
|
|||
|
|
|
|||
|
|
import "time"
|
|||
|
|
|
|||
|
|
// Chapter 对应表 chapters(与 Prisma 一致),JSON 小写驼峰
|
|||
|
|
type Chapter struct {
|
|||
|
|
ID string `gorm:"column:id;primaryKey;size:20" json:"id"`
|
|||
|
|
PartID string `gorm:"column:part_id;size:20" json:"partId"`
|
|||
|
|
PartTitle string `gorm:"column:part_title;size:100" json:"partTitle"`
|
|||
|
|
ChapterID string `gorm:"column:chapter_id;size:20" json:"chapterId"`
|
|||
|
|
ChapterTitle string `gorm:"column:chapter_title;size:200" json:"chapterTitle"`
|
|||
|
|
SectionTitle string `gorm:"column:section_title;size:200" json:"sectionTitle"`
|
|||
|
|
Content string `gorm:"column:content;type:longtext" json:"content,omitempty"`
|
|||
|
|
WordCount *int `gorm:"column:word_count" json:"wordCount,omitempty"`
|
|||
|
|
IsFree *bool `gorm:"column:is_free" json:"isFree,omitempty"`
|
|||
|
|
Price *float64 `gorm:"column:price;type:decimal(10,2)" json:"price,omitempty"`
|
|||
|
|
SortOrder *int `gorm:"column:sort_order" json:"sortOrder,omitempty"`
|
|||
|
|
Status *string `gorm:"column:status;size:20" json:"status,omitempty"`
|
|||
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|||
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (Chapter) TableName() string { return "chapters" }
|