Documentation
¶
Index ¶
- Constants
- Variables
- type Article
- type ArticleResponse
- type ArticleTag
- type Category
- type CategoryResponse
- type Comment
- type CommentResponse
- type CreateCommentForm
- type Favorite
- type FavoriteResponse
- type GithubUser
- type Message
- type MessageResponse
- type Model
- type OauthClient
- type OauthToken
- type SysConfig
- type Tag
- type TagResponse
- type Topic
- type TopicResponse
- type TopicTag
- type User
- type UserInfo
Constants ¶
View Source
const ( UserStatusOk = 0 UserStatusDisabled = 1 UserTypeNormal = 0 // 普通用户 UserTypeGzh = 1 // 公众号用户 CategoryStatusOk = 0 CategoryStatusDisabled = 1 TagStatusOk = 0 TagStatusDisabled = 1 ArticleStatusPublished = 0 // 已发布 ArticleStatusDeleted = 1 // 已删除 ArticleStatusDraft = 2 // 草稿 TopicStatusOk = 0 TopicStatusDeleted = 1 ArticleContentTypeHtml = "html" ArticleContentTypeMarkdown = "markdown" CommentStatusOk = 0 CommentStatusDeleted = 1 EntityTypeArticle = "article" EntityTypeTopic = "topic" MsgStatusUnread = 0 // 消息未读 MsgStatusReaded = 1 // 消息已读 MsgTypeComment = 0 // 回复消息 )
View Source
const ( OauthClientStatusOk = 0 OauthClientStatusDisabled = 1 )
Variables ¶
View Source
var ( // 系统配置 SysConfigSiteTitle = "site.title" SysConfigSiteDescription = "site.description" SysConfigSiteKeywords = "site.keywords" SysConfigRecommendTags = "recommend.tags" // 模版全局变量 TplCurrentUser = "CurrentUser" TplSiteTitle = "SiteTitle" TplSiteDescription = "SiteDescription" TplSiteKeywords = "SiteKeywords" // 错误码 ErrorCodeUserNameExists = 10 // 用户名已存在 ErrorCodeEmailExists = 11 // 邮箱已经存在 )
View Source
var Models = []interface{}{ &User{}, &GithubUser{}, &Category{}, &Tag{}, &Article{}, &ArticleTag{}, &Comment{}, &Favorite{}, &Topic{}, &TopicTag{}, &Message{}, &OauthClient{}, &OauthToken{}, &SysConfig{}, }
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Model
CategoryId int64 `gorm:"index:idx_category_id;not null" json:"categoryId" form:"categoryId"` // 分类编号
UserId int64 `gorm:"index:idx_user_id" json:"userId" form:"userId"` // 所属用户编号
Title string `gorm:"size:128;not null;" json:"title" form:"title"` // 标题
Summary string `gorm:"type:text" json:"summary" form:"summary"` // 摘要
Content string `gorm:"type:longtext;not null;" json:"content" form:"content"` // 内容
ContentType string `gorm:"type:varchar(32);not null" json:"contentType" form:"contentType"` // 内容类型:markdown、html
Status int `gorm:"int;not null" json:"status" form:"status"` // 状态
SourceUrl string `gorm:"type:text" json:"sourceUrl" form:"sourceUrl"` // 原文链接
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
文章
type ArticleResponse ¶
type ArticleResponse struct {
ArticleId int64 `json:"articleId"`
User *UserInfo `json:"user"`
Category *CategoryResponse `json:"category"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
Summary string `json:"summary"`
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
SourceUrl string `json:"sourceUrl"`
CreateTime int64 `json:"createTime"`
}
type ArticleTag ¶
type ArticleTag struct {
Model
ArticleId int64 `gorm:"not null" json:"articleId" form:"articleId"` // 文章编号
TagId int64 `gorm:"not null" json:"tagId" form:"tagId"` // 标签编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
文章标签
type Category ¶
type Category struct {
Model
Name string `gorm:"size:32;unique;not null" json:"name" form:"name"`
Description string `gorm:"size:1024" json:"description" form:"description"`
Status int `gorm:"index:idx_status;not null" json:"status" form:"status"`
CreateTime int64 `json:"createTime" form:"createTime"`
UpdateTime int64 `json:"updateTime" form:"updateTime"`
}
分类
type CategoryResponse ¶
type CategoryResponse struct {
CategoryId int64 `json:"categoryId"`
CategoryName string `json:"categoryName"`
Tags []TagResponse `json:"tags"`
}
type Comment ¶
type Comment struct {
Model
UserId int64 `gorm:"index:idx_user_id;not null" json:"userId" form:"userId"` // 用户编号
EntityType string `gorm:"index:idx_entity_type;not null" json:"entityType" form:"entityType"` // 被评论实体类型
EntityId int64 `gorm:"index:idx_entity_id;not null" json:"entityId" form:"entityId"` // 被评论实体编号
Content string `gorm:"type:text;not null" json:"content" form:"content"` // 内容
QuoteId int64 `gorm:"not null" json:"quoteId" form:"quoteId"` // 引用的评论编号
Status int `gorm:"int" json:"status" form:"status"` // 状态:0:待审核、1:审核通过、2:审核失败、3:已发布
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
评论
type CommentResponse ¶
type CommentResponse struct {
CommentId int64 `json:"commentId"`
User *UserInfo `json:"user"`
EntityType string `json:"entityType"`
EntityId int64 `json:"entityId"`
Content template.HTML `json:"content"`
QuoteId int64 `json:"quoteId"`
Quote *CommentResponse `json:"quote"`
QuoteContent template.HTML `json:"quoteContent"`
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
type CreateCommentForm ¶ added in v1.0.2
type CreateCommentForm struct {
EntityType string `form:"entityType"`
EntityId int64 `form:"entityId"`
Content string `form:"content"`
QuoteId int64 `form:"quoteId"`
}
发表评论
type Favorite ¶
type Favorite struct {
Model
UserId int64 `gorm:"index:idx_user_id;not null" json:"userId" form:"userId"` // 用户编号
EntityType string `gorm:"index:idx_entity_type;not null" json:"entityType" form:"entityType"` // 收藏实体类型
EntityId int64 `gorm:"index:idx_entity_id;not null" json:"entityId" form:"entityId"` // 收藏实体编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
收藏
type FavoriteResponse ¶
type FavoriteResponse struct {
FavoriteId int64 `json:"favoriteId"`
EntityType string `json:"entityType"`
EntityId int64 `json:"entityId"`
Deleted bool `json:"deleted"`
Title string `json:"title"`
Content string `json:"content"`
User *UserInfo `json:"user"`
Url string `json:"url"`
CreateTime int64 `json:"createTime"`
}
type GithubUser ¶
type GithubUser struct {
Model
UserId int64 `json:"userId" form:"userId"`
GithubId int64 `gorm:"unique" json:"githubId" form:"githubId"`
Login string `gorm:"size:512" json:"login" form:"login"`
NodeId string `gorm:"size:512" json:"nodeId" form:"nodeId"`
AvatarUrl string `gorm:"size:1024" json:"avatarUrl" form:"avatarUrl"`
Url string `gorm:"size:1024" json:"url" form:"url"`
HtmlUrl string `gorm:"size:1024" json:"htmlUrl" form:"htmlUrl"`
Email string `gorm:"size:512" json:"email" form:"email"`
Name string `gorm:"size:32" json:"name" form:"name"`
Bio string `gorm:"type:text" json:"bio" form:"bio"`
Company string `gorm:"size:128" json:"company" form:"company"`
Blog string `gorm:"type:text" json:"blog" form:"blog"`
Location string `gorm:"size:128" json:"location" form:"location"`
CreateTime int64 `json:"createTime" form:"createTime"`
UpdateTime int64 `json:"updateTime" form:"updateTime"`
}
type Message ¶
type Message struct {
Model
FromId int64 `gorm:"not null" json:"fromId" form:"fromId"` // 消息发送人
UserId int64 `gorm:"not null" json:"userId" form:"userId"` // 用户编号(消息接收人)
Content string `gorm:"type:text;not null" json:"content" form:"content"` // 消息内容
QuoteContent string `gorm:"type:text" json:"quoteContent" form:"quoteContent"` // 引用内容
Type int `gorm:"not null" json:"type" form:"type"` // 消息类型
ExtraData string `gorm:"type:text" json:"extraData" form:"extraData"` // 扩展数据
Status int `gorm:"not null" json:"status" form:"status"` // 状态:0:未读、1:已读
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
消息
type MessageResponse ¶
type MessageResponse struct {
MessageId int64 `json:"messageId"`
From *UserInfo `json:"from"` // 消息发送人
UserId int64 `json:"userId"` // 消息接收人编号
Content string `json:"content"`
QuoteContent string `json:"quoteContent"`
Type int `json:"type"`
DetailUrl string `json:"detailUrl"` // 消息详情url
ExtraData string `json:"extraData"`
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
消息
type OauthClient ¶
type OauthClient struct {
Model
ClientId string `gorm:"unique;not null;size:64" json:"clientId" form:"clientId"`
ClientSecret string `gorm:"size:128" json:"clientSecret" form:"clientSecret"`
Domain string `gorm:"size:1024" json:"domain" form:"domain"`
CallbackUrl string `gorm:"size:1024" json:"callbackUrl" form:"callbackUrl"`
Status int `gorm:"index:idx_status" json:"status" form:"status"`
CreateTime time.Time `json:"createTime" form:"createTime"`
}
type OauthToken ¶
type OauthToken struct {
Model
ExpiredAt int64 `gorm:"index:idx_expired_at" json:"expiredAt"`
Code string `gorm:"index:idx_code" json:"code"`
AccessToken string `gorm:"index:idx_access_token" json:"accessToken"`
RefreshToken string `gorm:"index:idx_refresh_token" json:"refreshToken"`
Data string `gorm:"type:text" json:"data"`
}
type SysConfig ¶ added in v1.0.4
type SysConfig struct {
Model
Key string `gorm:"not null;size:128;unique" json:"key" form:"key"` // 配置key
Value string `gorm:"type:text" json:"value" form:"value"` // 配置值
Name string `gorm:"not null;size:32" json:"name" form:"name"` // 配置名称
Description string `gorm:"size:128" json:"description" form:"description"` // 配置描述
CreateTime int64 `gorm:"not null" json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `gorm:"not null" json:"updateTime" form:"updateTime"` // 更新时间
}
系统配置
type Tag ¶
type Tag struct {
Model
Name string `gorm:"size:32;unique;not null" json:"name" form:"name"`
Description string `gorm:"size:1024" json:"description" form:"description"`
Status int `gorm:"index:idx_status;not null" json:"status" form:"status"`
CreateTime int64 `json:"createTime" form:"createTime"`
UpdateTime int64 `json:"updateTime" form:"updateTime"`
}
标签
type TagResponse ¶
type Topic ¶
type Topic struct {
Model
UserId int64 `gorm:"not null" json:"userId" form:"userId"` // 用户
Title string `gorm:"size:128" json:"title" form:"title"` // 标题
Content string `gorm:"type:longtext" json:"content" form:"content"` // 内容
ViewCount int64 `gorm:"not null" json:"viewCount" form:"viewCount"` // 查看数量
Status int `gorm:"int" json:"status" form:"status"` // 状态:0:正常、1:删除
LastCommentTime int64 `json:"lastCommentTime" form:"lastCommentTime"` // 最后回复时间
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
主题
type TopicResponse ¶
type TopicResponse struct {
TopicId int64 `json:"topicId"`
User *UserInfo `json:"user"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
LastCommentTime int64 `json:"lastCommentTime"`
ViewCount int64 `json:"viewCount"`
CreateTime int64 `json:"createTime"`
}
type TopicTag ¶
type TopicTag struct {
Model
TopicId int64 `gorm:"not null" json:"topicId" form:"topicId"` // 主题编号
TagId int64 `gorm:"not null" json:"tagId" form:"tagId"` // 标签编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
主题标签
type User ¶
type User struct {
Model
Username string `gorm:"size:32;unique" json:"username" form:"username"`
Nickname string `gorm:"size:16" json:"nickname" form:"nickname"`
Avatar string `gorm:"type:text" json:"avatar" form:"avatar"`
Email string `gorm:"size:512;" json:"email" form:"email"`
Password string `gorm:"size:512" json:"password" form:"password"`
Status int `gorm:"index:idx_status;not null" json:"status" form:"status"`
Roles string `gorm:"type:text" json:"roles" form:"roles"`
Type int `gorm:"not null" json:"type" form:"type"`
Description string `gorm:"type:text" json:"description" form:"description"`
CreateTime int64 `json:"createTime" form:"createTime"`
UpdateTime int64 `json:"updateTime" form:"updateTime"`
}
type UserInfo ¶
type UserInfo struct {
Id int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Email string `json:"email"`
Type int `json:"type"`
Roles []string `json:"roles"`
Description string `json:"description"`
CreateTime int64 `json:"createTime"`
}
Click to show internal directories.
Click to hide internal directories.