Documentation ¶
Overview ¶
Package model is the "model" layer which defines entity structures with ORM and controller.
Index ¶
Constants ¶
View Source
const ( CorrelationCategoryTag = iota CorrelationArticleTag CorrelationBlogUser CorrelationArticleArchive )
Correlation types.
View Source
const ()
Navigation open methods.
View Source
const ( SettingCategorySystem = "system" SettingNameSystemVer = "systemVersion" )
Setting names of category "system".
View Source
const ( SettingCategoryTheme = "theme" SettingNameThemeName = "themeName" )
Setting names of category "theme".
View Source
const ( SettingCategoryBasic = "basic" SettingNameBasicBlogURL = "basicBlogURL" SettingNameBasicBlogSubtitle = "basicBlogSubtitle" SettingNameBasicBlogTitle = "basicBlogTitle" SettingNameBasicCommentable = "basicCommentable" SettingNameBasicHeader = "basicHeader" SettingNameBasicNoticeBoard = "basicNoticeBoard" SettingNameBasicMetaDescription = "basicMetaDescription" SettingNameBasicMetaKeywords = "basicMetaKeywords" SettingNameBasicFaviconURL = "basicFaviconURL" SettingNameBasicLogoURL = "basicLogoURL" )
Setting names of catgory "basic".
View Source
const ( SettingCategoryPreference = "preference" SettingNamePreferenceArticleListPageSize = "preferenceArticleListPageSize" SettingNamePreferenceArticleListWindowSize = "preferenceArticleListWindowSize" SettingNamePreferenceArticleListStyle = "preferenceArticleListStyle" SettingNamePreferenceMostCommentArticleListSize = "preferenceMostCommentArticleListSize" SettingNamePreferenceMostUseTagListSize = "preferenceMostUseTagListSize" SettingNamePreferenceMostViewArticleListSize = "preferenceMostViewArticleListSize" SettingNamePreferenceRecentCommentListSize = "preferenceRecentCommentListSize" )
Setting names of category "preference".
View Source
const ( SettingCategorySign = "sign" SettingNameArticleSign = "signArticle" )
Setting names of category "sign".
View Source
const ( SettingCategoryI18n = "i18n" SettingNameI18nLocale = "i18nLocale" SettingNameI18nTimezone = "i18nTimezone" )
Setting names of category "i18n".
View Source
const ( SettingCategoryFeed = "feed" SettingNameFeedOutputMode = "feedOutputMode" )
Setting names of category "feed".
View Source
const ( SettingFeedOutputModeValueAbstract = 0 SettingFeedOutputModeValueFull = 1 )
Setting value of category "feed".
View Source
const ( SettingCategoryStatistic = "statistic" SettingNameStatisticArticleCount = "statisticArticleCount" SettingNameStatisticCommentCount = "statisticCommentCount" SettingNameStatisticViewCount = "statisticViewCount" )
Setting names of category "statistic".
View Source
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".
View Source
const ( UserRoleNoLogin = iota UserRolePlatformAdmin UserRoleBlogAdmin UserRoleBlogUser )
User roles.
View Source
const (
ArticleStatusOK = iota
)
Article statuses.
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 uint `json:"blogID"` }
Archive model.
type Article ¶
type Article struct { Model AuthorID uint `json:"authorID"` Title string `gorm:"size:128" json:"title"` Tags string `gorm:"size:128" json:"tags"` Content string `gorm:"type:text" json:"content"` Path string `sql:"index" gorm:"size:255" json:"path"` Status int `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 uint `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:"size:128" json:"tags"` Number int `json:"number"` // for sorting BlogID uint `json:"blogID"` }
Category model.
type Comment ¶
type Comment struct { Model ArticleID uint `json:"articleID"` AuthorID uint `json:"authorID"` Content string `gorm:"type:text" json:"content"` ParentCommentID uint `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"` BlogID uint `json:"blogID"` }
Comment model.
type Correlation ¶
type Correlation struct { Model ID1 uint `json:"id1"` ID2 uint `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 uint `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 `gorm:"size:32" json:"category"` Name string `gorm:"size:32" json:"name"` Value string `gorm:"type:text" json:"value"` BlogID uint `json:"blogID"` }
Setting model.
type Tag ¶
type Tag struct { Model Title string `gorm:"size:128" json:"title"` ArticleCount int `json:"articleCount"` BlogID uint `json:"blogID"` }
Tag model.
type ThemeArchive ¶
type ThemeArticle ¶
type ThemeArticle struct { ID uint `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 uint 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.
func (*User) AvatarURLWithSize ¶
Click to show internal directories.
Click to hide internal directories.