28 lines
800 B
Go
28 lines
800 B
Go
package models
|
|
|
|
// PostSnippet 文章与代码片段关联
|
|
type PostSnippet struct {
|
|
PostID uint `json:"postId" gorm:"primaryKey;column:post_id"`
|
|
SnippetID uint `json:"snippetId" gorm:"primaryKey;column:snippet_id"`
|
|
SortOrder uint `json:"sortOrder" gorm:"column:sort_order;default:0"`
|
|
CreatedAt int64 `json:"createdAt" gorm:"column:created_at;default:0"`
|
|
}
|
|
|
|
func (PostSnippet) TableName() string {
|
|
return "post_snippets"
|
|
}
|
|
|
|
// PostBrief 文章简要信息
|
|
type PostBrief struct {
|
|
ID uint `json:"id"`
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
// SnippetBrief 代码片段简要信息
|
|
type SnippetBrief struct {
|
|
ID uint `json:"id"`
|
|
Title string `json:"title"`
|
|
Type string `json:"type"`
|
|
CodeType *CodeTypeResponse `json:"codeType,omitempty"`
|
|
}
|