article_section.go
707 字节
package models
import (
"time"
"gorm.io/gorm"
)
// 文章段落
type ArticleSection struct {
Id int64
UpdatedAt time.Time // 更新时间
DeletedAt gorm.DeletedAt //
CreatedAt time.Time //
ArticleId int64 // 文章id
Content string // 文本内容
SortBy int // 排序
TotalComment int // 评论的数量
}
func (m *ArticleSection) TableName() string {
return "article_section"
}
func (m *ArticleSection) BeforeCreate(tx *gorm.DB) (err error) {
m.CreatedAt = time.Now()
m.UpdatedAt = time.Now()
return
}
func (m *ArticleSection) BeforeUpdate(tx *gorm.DB) (err error) {
m.UpdatedAt = time.Now()
return
}