Documentation ¶
Overview ¶
Package model is the "model" layer which defines entity structures with ORM and controller.
Index ¶
Constants ¶
const ( CorrelationCategoryTag = iota CorrelationArticleTag CorrelationBlogUser CorrelationArticleArchive )
Correlation types.
const ()
Navigation open methods.
const ( SettingCategorySystem = "system" SettingNameSystemVer = "systemVersion" )
Setting names of category "system".
const ( SettingCategoryTheme = "theme" SettingNameThemeName = "themeName" )
Setting names of category "theme".
const ( SettingCategoryBasic = "basic" SettingNameBasicBlogURL = "basicBlogURL" SettingNameBasicBlogSubtitle = "basicBlogSubtitle" SettingNameBasicBlogTitle = "basicBlogTitle" SettingNameBasicCommentable = "basicCommentable" SettingNameBasicHeader = "basicHeader" // Removed from UI since v1.1.0 caused by issue 54 (https://github.com/b3log/pipe/issues/54) SettingNameBasicNoticeBoard = "basicNoticeBoard" SettingNameBasicMetaDescription = "basicMetaDescription" SettingNameBasicMetaKeywords = "basicMetaKeywords" SettingNameBasicFaviconURL = "basicFaviconURL" SettingNameBasicLogoURL = "basicLogoURL" )
Setting names of category "basic".
const ( SettingBasicHeaderDefault = "<!-- https://github.com/b3log/pipe/issues/54 -->" SettingBasicBasicNoticeBoardDefault = "<!-- 支持 Markdown -->本博客由 [Pipe](https://github.com/b3log/pipe) 强力驱动" )
Setting values of category "basic".
const ( SettingCategoryPreference = "preference" SettingNamePreferenceArticleListPageSize = "preferenceArticleListPageSize" SettingNamePreferenceArticleListWindowSize = "preferenceArticleListWindowSize" SettingNamePreferenceArticleListStyle = "preferenceArticleListStyle" SettingNamePreferenceMostCommentArticleListSize = "preferenceMostCommentArticleListSize" SettingNamePreferenceMostUseTagListSize = "preferenceMostUseTagListSize" SettingNamePreferenceMostViewArticleListSize = "preferenceMostViewArticleListSize" SettingNamePreferenceRecentCommentListSize = "preferenceRecentCommentListSize" )
Setting names of category "preference".
const ( SettingPreferenceArticleListStyleValueTitle = 0 SettingPreferenceArticleListStyleValueTitleAbstract = 1 SettingPreferenceArticleListStyleValueTitleContent = 2 SettingPreferenceArticleListPageSizeDefault = 20 SettingPreferenceArticleListWindowSizeDefault = 7 SettingPreferenceArticleListStyleDefault = SettingPreferenceArticleListStyleValueTitleAbstract SettingPreferenceMostCommentArticleListSizeDefault = 7 SettingPreferenceMostUseTagListSizeDefault = 15 SettingPreferenceMostViewArticleListSizeDefault = 15 SettingPreferenceRecentCommentListSizeDefault = 7 )
Setting values of category "preference".
const ( SettingCategorySign = "sign" SettingNameArticleSign = "signArticle" )
Setting names of category "sign".
const ( SettingCategoryI18n = "i18n" SettingNameI18nLocale = "i18nLocale" SettingNameI18nTimezone = "i18nTimezone" )
Setting names of category "i18n".
const ( SettingCategoryFeed = "feed" SettingNameFeedOutputMode = "feedOutputMode" )
Setting names of category "feed".
const ( SettingFeedOutputModeValueAbstract = 0 SettingFeedOutputModeValueFull = 1 )
Setting values of category "feed".
const ( SettingCategoryThirdStatistic = "thirdStatistic" SettingNameThirdStatisticBaidu = "thirdStatisticBaidu" )
Setting names of category "thirdStatistic".
const ( SettingCategoryStatistic = "statistic" SettingNameStatisticArticleCount = "statisticArticleCount" SettingNameStatisticCommentCount = "statisticCommentCount" SettingNameStatisticViewCount = "statisticViewCount" )
Setting names of category "statistic".
const ( UserRoleNoLogin = iota UserRolePlatformAdmin UserRoleBlogAdmin UserRoleBlogUser )
User roles.
const (
ArticleStatusOK = iota
)
Article statuses.
const (
SettingArticleSignDefault = "<!-- 支持 Markdown;可用变量 {title}, {author}, {url} -->"
)
Setting values of category "sign".
const SyncCommentAuthorID = math.MaxInt32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct { Model Year string `gorm:"size:4" json:"year"` Month string `gorm:"size:2" json:"month"` ArticleCount int `json:"articleCount"` BlogID uint64 `sql:"index" json:"blogID"` }
Archive model.
type Article ¶
type Article struct { Model AuthorID uint64 `json:"authorID"` Title string `gorm:"size:128" json:"title"` Tags string `gorm:"type:text" json:"tags"` Content string `gorm:"type:mediumtext" json:"content"` Path string `sql:"index" gorm:"size:255" json:"path"` Status int `sql:"index" json:"status"` Topped bool `json:"topped"` Commentable bool `json:"commentable"` ViewCount int `json:"viewCount"` CommentCount int `json:"commentCount"` IP string `gorm:"size:128" json:"ip"` UserAgent string `gorm:"size:255" json:"userAgent"` PushedAt time.Time `json:"pushedAt"` BlogID uint64 `sql:"index" json:"blogID"` }
Article model.
type Category ¶
type Category struct { Model Title string `gorm:"size:128" json:"title"` Path string `gorm:"size:255" json:"path"` Description string `gorm:"size:255" json:"description"` MetaKeywords string `gorm:"size:255" json:"metaKeywords"` MetaDescription string `gorm:"type:text" json:"metaDescription"` Tags string `gorm:"type:text" json:"tags"` Number int `json:"number"` // for sorting BlogID uint64 `sql:"index" json:"blogID"` }
Category model.
type Comment ¶
type Comment struct { Model ArticleID uint64 `json:"articleID"` AuthorID uint64 `json:"authorID"` Content string `gorm:"type:text" json:"content"` ParentCommentID uint64 `json:"parentCommentID"` // ID of replied comment IP string `gorm:"size:128" json:"ip"` UserAgent string `gorm:"size:255" json:"userAgent"` PushedAt time.Time `json:"pushedAt"` AuthorName string `gorm:"size:32" json:"authorName"` // exist if this comment sync from Sym, https://github.com/b3log/pipe/issues/98 AuthorAvatarURL string `gorm:"size:255" json:"authorAvatarURL"` // exist if this comment sync from Sym, https://github.com/b3log/pipe/issues/98 AuthorURL string `gorm:"size:255" json:"authorURL"` // exist if this comment sync from Sym, https://github.com/b3log/pipe/issues/98 BlogID uint64 `sql:"index" json:"blogID"` }
Comment model.
type Correlation ¶
type Correlation struct { Model ID1 uint64 `json:"id1"` ID2 uint64 `json:"id2"` Str1 string `gorm:"size:255" json:"str1"` Str2 string `gorm:"size:255" json:"str2"` Str3 string `gorm:"size:255" json:"str3"` Str4 string `gorm:"size:255" json:"str4"` Int1 int `json:"int1"` Int2 int `json:"int2"` Int3 int `json:"int3"` Int4 int `json:int4` Type int `json:"type"` BlogID uint64 `sql:"index" json:"blogID"` }
Correlation model.
id1(category_id) - id2(tag_id) id1(article_id) - id2(tag_id) id1(blog_id) - id2(user_id) - int1(role) - int2(article_count) id1(article_id) - id2(archive_id)
type Setting ¶
type Setting struct { Model Category string `sql:"index" gorm:"size:32" json:"category"` Name string `sql:"index" gorm:"size:64" json:"name"` Value string `gorm:"type:text" json:"value"` BlogID uint64 `sql:"index" json:"blogID"` }
Setting model.
type Tag ¶
type Tag struct { Model Title string `gorm:"size:128" json:"title"` ArticleCount int `json:"articleCount"` BlogID uint64 `sql:"index" json:"blogID"` }
Tag model.
type ThemeArchive ¶
type ThemeArticle ¶
type ThemeArticle struct { ID uint64 `json:",omitempty"` Abstract template.HTML `json:"abstract"` Author *ThemeAuthor `json:",omitempty"` CreatedAt string `json:",omitempty"` Title string `json:"title"` Tags []*ThemeTag `json:"tags"` URL string `json:"url"` Topped bool `json:",omitempty"` ViewCount int `json:",omitempty"` CommentCount int `json:",omitempty"` ThumbnailURL string `json:",omitempty"` Content template.HTML `json:",omitempty"` Editable bool `json:",omitempty"` }
type ThemeAuthor ¶
func (*ThemeAuthor) AvatarURLWithSize ¶
func (author *ThemeAuthor) AvatarURLWithSize(size int) string
type ThemeCategory ¶
type ThemeComment ¶
type ThemeComment struct { ID uint64 Title string Content template.HTML URL string Author *ThemeAuthor CreatedAt string Removable bool ReplyCount int Parent *ThemeComment }
type ThemeReply ¶
type User ¶
type User struct { Model Name string `gorm:"size:32" json:"name"` Nickname string `gorm:"size:32" json:"nickname"` AvatarURL string `gorm:"size:255" json:"avatarURL"` B3Key string `gorm:"size:32" json:"b3Key"` Locale string `gorm:"size:32 json:"locale"` TotalArticleCount int `json:"totalArticleCount"` }
User model.