Documentation
¶
Index ¶
- Constants
- Variables
- type Article
- type ArticleResponse
- type ArticleSimpleResponse
- type ArticleTag
- type CollectArticle
- type CollectRule
- type Comment
- type CommentResponse
- type ConfigResponse
- type Favorite
- type FavoriteResponse
- type Link
- type Message
- type MessageResponse
- type Model
- type NodeResponse
- type Project
- type ProjectResponse
- type ProjectSimpleResponse
- type SiteNav
- type SysConfig
- type Tag
- type TagResponse
- type ThirdAccount
- type Topic
- type TopicLike
- type TopicNode
- type TopicResponse
- type TopicSimpleResponse
- type TopicTag
- type User
- type UserInfo
- type UserToken
Constants ¶
View Source
const ( StatusOk = 0 // 正常 StatusDeleted = 1 // 删除 StatusPending = 2 // 待审核 UserTypeNormal = 0 // 普通用户 UserTypeGzh = 1 // 公众号用户 ContentTypeHtml = "html" ContentTypeMarkdown = "markdown" EntityTypeArticle = "article" EntityTypeTopic = "topic" MsgStatusUnread = 0 // 消息未读 MsgStatusReaded = 1 // 消息已读 MsgTypeComment = 0 // 回复消息 CollectArticleStatusPending = 0 // 待审核 CollectArticleStatusAuditPass = 1 // 审核通过 CollectArticleStatusAuditFail = 2 // 审核失败 CollectArticleStatusPublished = 3 // 已发布 ThirdAccountTypeGithub = "github" ThirdAccountTypeQQ = "qq" )
Variables ¶
View Source
var Models = []interface{}{ &User{}, &UserToken{}, &Tag{}, &Article{}, &ArticleTag{}, &Comment{}, &Favorite{}, &Topic{}, &TopicNode{}, &TopicTag{}, &TopicLike{}, &Message{}, &SysConfig{}, &Project{}, &Link{}, &CollectRule{}, &CollectArticle{}, &ThirdAccount{}, }
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Model
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"` // 原文链接
ViewCount int64 `gorm:"not null;index:idx_view_count;" json:"viewCount" form:"viewCount"` // 查看数量
CreateTime int64 `gorm:"index:idx_create_time" json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
文章
type ArticleResponse ¶
type ArticleResponse struct {
ArticleSimpleResponse
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
}
type ArticleSimpleResponse ¶
type ArticleSimpleResponse struct {
ArticleId int64 `json:"articleId"`
User *UserInfo `json:"user"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
Summary string `json:"summary"`
SourceUrl string `json:"sourceUrl"`
ViewCount int64 `json:"viewCount"`
CreateTime int64 `json:"createTime"`
}
type ArticleTag ¶
type ArticleTag struct {
Model
ArticleId int64 `gorm:"not null;index:idx_article_id;" json:"articleId" form:"articleId"` // 文章编号
TagId int64 `gorm:"not null;index:idx_tag_id;" json:"tagId" form:"tagId"` // 标签编号
Status int64 `gorm:"not null;index:idx_status" json:"status" form:"status"` // 状态:正常、删除
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
文章标签
type CollectArticle ¶
type CollectArticle struct {
Model
UserId int64 `gorm:"index:idx_user_id;not null" json:"userId" form:"userId"` // 用户编号
RuleId int64 `gorm:"index:idx_rule_id;not null" json:"ruleId" form:"ruleId"` // 采集规则编号
LinkId int64 `gorm:"not null;index:idx_link_id" json:"linkId" form:"linkId"` // CollectLink外键
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
SourceUrl string `gorm:"type:text" json:"sourceUrl" form:"sourceUrl"` // 原文链接
SourceId string `gorm:"size:1024" json:"sourceId" form:"sourceId"` // 原id
SourceUrlMd5 string `gorm:"index:idx_url_md5" json:"sourceUrlMd5" form:"sourceUrlMd5"` // url md5
SourceTitleMd5 string `gorm:"index:idx_title_md5" json:"sourceTitleMd5" form:"sourceTitleMd5"` // 标题 md5
Status int `gorm:"int" json:"status" form:"status"` // 状态:0:待审核、1:审核通过、2:审核失败、3:已发布
ArticleId int64 `gorm:"index:idx_article_id;not null" json:"articleId" form:"articleId"` // 发布之后的文章id
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
采集文章
type CollectRule ¶
type CollectRule struct {
Model
Title string `gorm:"not null;size:128" json:"title" form:"title"` // 标题
Rule string `gorm:"type:text;not null" json:"rule" form:"rule"` // 规则详情,JSON文件
Status int `gorm:"not null" json:"status" form:"status"` // 状态
Description string `gorm:"size:1024" json:"description" form:"description"` // 规则描述
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
采集规则
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"` // 内容
ContentType string `gorm:"type:varchar(32);not null" json:"contentType" form:"contentType"` // 内容类型:markdown、html
QuoteId int64 `gorm:"not null" json:"quoteId" form:"quoteId"` // 引用的评论编号
Status int `gorm:"int;index:idx_status" 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 ConfigResponse ¶
type ConfigResponse struct {
SiteTitle string `json:"siteTitle"`
SiteDescription string `json:"siteDescription"`
SiteKeywords []string `json:"siteKeywords"`
RecommendTags []string `json:"recommendTags"`
UrlRedirect bool `json:"urlRedirect"`
}
配置返回结构体
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;size:32;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 Link ¶
type Link struct {
Model
Url string `gorm:"not null;type:text" json:"url" form:"url"` // 链接
Title string `gorm:"not null;size:128" json:"title" form:"title"` // 标题
Summary string `gorm:"size:1024" json:"summary" form:"summary"` // 站点描述
Logo string `gorm:"type:text" json:"logo" form:"logo"` // LOGO
Category string `gorm:"type:text" json:"category" form:"category"` // 分类
Status int `gorm:"not null" json:"status" form:"status"` // 状态
Score int `gorm:"not null" json:"score" form:"score"` // 评分,0-100分,分数越高越优质
Remark string `gorm:"size:1024" json:"remark" form:"remark"` // 备注,后台填写的
CreateTime int64 `gorm:"not null" json:"createTime" form:"createTime"` // 创建时间
}
type Message ¶
type Message struct {
Model
FromId int64 `gorm:"not null" json:"fromId" form:"fromId"` // 消息发送人
UserId int64 `gorm:"not null;index:idx_user_id;" 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 NodeResponse ¶
type Project ¶
type Project struct {
Model
UserId int64 `gorm:"not null" json:"userId" form:"userId"`
Name string `gorm:"type:varchar(1024)" json:"name" form:"name"`
Title string `gorm:"type:text" json:"title" form:"title"`
Logo string `gorm:"type:varchar(1024)" json:"logo" form:"logo"`
Url string `gorm:"type:varchar(1024)" json:"url" form:"url"`
DocUrl string `gorm:"type:varchar(1024)" json:"docUrl" form:"docUrl"`
DownloadUrl string `gorm:"type:varchar(1024)" json:"downloadUrl" form:"downloadUrl"`
ContentType string `gorm:"type:varchar(32);" json:"contentType" form:"contentType"`
Content string `gorm:"type:longtext" json:"content" form:"content"`
CreateTime int64 `json:"createTime" form:"createTime"`
}
开源项目
type ProjectResponse ¶
type ProjectResponse struct {
ProjectSimpleResponse
Content template.HTML `json:"content"`
}
项目详情
type ProjectSimpleResponse ¶
type ProjectSimpleResponse struct {
ProjectId int64 `json:"projectId"`
User *UserInfo `json:"user"`
Name string `json:"name"`
Title string `json:"title"`
Logo string `json:"logo"`
Url string `json:"url"`
DocUrl string `json:"docUrl"`
DownloadUrl string `json:"downloadUrl"`
Summary string `json:"summary"`
CreateTime int64 `json:"createTime"`
}
项目简单返回
type SysConfig ¶
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 ThirdAccount ¶
type ThirdAccount struct {
Model
UserId sql.NullInt64 `gorm:"unique_index:idx_user_id_third_type;" json:"userId" form:"userId"` // 用户编号
Avatar string `gorm:"size:1024" json:"avatar" form:"avatar"` // 头像
Nickname string `gorm:"size:32" json:"nickname" form:"nickname"` // 昵称
ThirdType string `gorm:"size:32;not null;unique_index:idx_user_id_third_type,idx_third;" json:"thirdType" form:"thirdType"` // 第三方类型
ThirdId string `gorm:"size:64;not null;unique_index:idx_third;" json:"thirdId" form:"thirdId"` // 第三方唯一标识,例如:openId,unionId
ExtraData string `gorm:"type:longtext" json:"extraData" form:"extraData"` // 扩展数据
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
type Topic ¶
type Topic struct {
Model
NodeId int64 `gorm:"not null;index:idx_node_id;" json:"nodeId" form:"nodeId"` // 节点编号
UserId int64 `gorm:"not null;index:idx_user_id;" 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"` // 查看数量
CommentCount int64 `gorm:"not null" json:"commentCount" form:"commentCount"` // 跟帖数量
LikeCount int64 `gorm:"not null" json:"likeCount" form:"likeCount"` // 点赞数量
Status int `gorm:"index:idx_status;" json:"status" form:"status"` // 状态:0:正常、1:删除
LastCommentTime int64 `gorm:"index:idx_last_comment_time" json:"lastCommentTime" form:"lastCommentTime"` // 最后回复时间
CreateTime int64 `gorm:"index:idx_create_time" json:"createTime" form:"createTime"` // 创建时间
ExtraData string `gorm:"type:text" json:"extraData" form:"extraData"` // 扩展数据
}
话题节点
type TopicLike ¶
type TopicLike struct {
Model
UserId int64 `gorm:"not null;index:idx_user_id;" json:"userId" form:"userId"` // 用户
TopicId int64 `gorm:"not null;index:idx_topic_id;" json:"topicId" form:"topicId"` // 主题编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
话题点赞
type TopicNode ¶
type TopicNode struct {
Model
Name string `gorm:"size:32;unique" json:"name" form:"name"` // 名称
Description string `json:"description" form:"description"` // 描述
SortNo int `gorm:"index:idx_sort_no" json:"sortNo" form:"sortNo"` // 排序编号
Status int `gorm:"not null" json:"status" form:"status"` // 状态
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
话题节点
type TopicResponse ¶
type TopicResponse struct {
TopicSimpleResponse
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
}
帖子详情返回实体
type TopicSimpleResponse ¶
type TopicSimpleResponse struct {
TopicId int64 `json:"topicId"`
User *UserInfo `json:"user"`
Node *NodeResponse `json:"node"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
Summary string `json:"summary"`
LastCommentTime int64 `json:"lastCommentTime"`
ViewCount int64 `json:"viewCount"`
CommentCount int64 `json:"commentCount"`
LikeCount int64 `json:"likeCount"`
Liked bool `json:"liked"`
CreateTime int64 `json:"createTime"`
}
帖子列表返回实体
type TopicTag ¶
type TopicTag struct {
Model
TopicId int64 `gorm:"not null;index:idx_topic_id;" json:"topicId" form:"topicId"` // 主题编号
TagId int64 `gorm:"not null;index:idx_tag_id;" json:"tagId" form:"tagId"` // 标签编号
Status int64 `gorm:"not null;index:idx_status" json:"status" form:"status"` // 状态:正常、删除
LastCommentTime int64 `gorm:"index:idx_last_comment_time" json:"lastCommentTime" form:"lastCommentTime"` // 最后回复时间
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
主题标签
type User ¶
type User struct {
Model
Username sql.NullString `gorm:"size:32;unique;" json:"username" form:"username"`
Email sql.NullString `gorm:"size:128;unique;" json:"email" form:"email"`
Nickname string `gorm:"size:16;" json:"nickname" form:"nickname"`
Avatar string `gorm:"type:text" json:"avatar" form:"avatar"`
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"`
Email string `json:"email"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Type int `json:"type"`
Roles []string `json:"roles"`
Description string `json:"description"`
PasswordSet bool `json:"passwordSet"` // 密码已设置
CreateTime int64 `json:"createTime"`
}
type UserToken ¶
type UserToken struct {
Model
Token string `gorm:"size:32;unique;not null" json:"token" form:"token"`
UserId int64 `gorm:"not null;index:idx_user_id;" json:"userId" form:"userId"`
ExpiredAt int64 `gorm:"not null" json:"expiredAt" form:"expiredAt"`
Status int `gorm:"not null;index:idx_status" json:"status" form:"status"`
CreateTime int64 `gorm:"not null" json:"createTime" form:"createTime"`
}
Click to show internal directories.
Click to hide internal directories.