Documentation
¶
Index ¶
- Constants
- Variables
- func AddArticle(article Article, tagsrt []string) error
- func AddCategory(category Category) error
- func AddReply(reply *Reply) error
- func AddTag(tag Tag) error
- func DelUserToken(token string) error
- func DeleteArticle(id int64) error
- func DeleteArticleTag(articleId int64) (err error)
- func DeleteCategory(Id int64, name string) error
- func DeleteReply(Id int64) error
- func DeleteTag(tagId int64) error
- func GetTotalArticleCount() int64
- func GetUserAvatar(uid int64) (path string, err error)
- func GetUserNameById(uid int) (string, error)
- func ModifyArticle(article *Article, raw_former_tag string, raw_tags string) error
- func ModifyCategory(former_category, category_name string) error
- func ModifyUserInfo(uid int64, username string, pwd string) error
- func RemoveDuplicates(articles *[]*Article)
- func RenameTag(tagId int64, tagName string) error
- func SaveArticleTag(article_id, tag_id int64) error
- func SaveUserAvatar(uid int64, path string) error
- func SetupTotalArticleCount() (err error)
- type Article
- func FindArticles(key string, byTitle bool, bySubtitle bool, byCategory bool, byTag bool) (articles []*Article, err error)
- func GetArticle(id int64) (*Article, error)
- func GetArticles(order_key string, category, tag string, uid int64, inverted bool, page int) (articles []*Article, article_count int, err error)
- func GetArticlesAccroingTagId(tagId int64) (articles []Article, count int64, err error)
- func GetArticlesAccroingTagName(name string) (articles []Article, count int64, err error)
- type ArticleTag
- type Category
- type Reply
- type Tag
- type User
Constants ¶
View Source
const ( Filter_Create = "created" Filter_Update = "updated" Filter_ViewCount = "view_count" Filter_LastReplyTime = "last_reply_time" Filter_UserName = "author" ArticlePerPageLimit = 10 )
文章字段过滤器
View Source
const ( Filter_Category_Create = "created" Filter_Category_ArticleCount = "article_count" )
分类字段过滤器
View Source
const UserTokenPeriod_s = 60 * 24 * 60 * 60
登陆有效期60天 day hour min sec
Variables ¶
View Source
var UserTokenPrefix string
Functions ¶
func AddArticle ¶
func AddCategory ¶
func DelUserToken ¶
func DeleteArticle ¶
func DeleteArticleTag ¶
func DeleteCategory ¶
func DeleteReply ¶
func GetTotalArticleCount ¶
func GetTotalArticleCount() int64
func GetUserAvatar ¶
func GetUserNameById ¶
func ModifyArticle ¶
func ModifyCategory ¶
func RemoveDuplicates ¶
func RemoveDuplicates(articles *[]*Article)
func SaveArticleTag ¶
func SaveUserAvatar ¶
func SetupTotalArticleCount ¶
func SetupTotalArticleCount() (err error)
Types ¶
type Article ¶
type Article struct {
Id int64
Title string `form:"title"`
Subtitle string `form:"subtitle"`
Content string `orm:"size(10000)" form:"content"`
Author *User `orm:"rel(fk)"`
Category string `form:"category"`
Created time.Time `orm:"index"`
Updated time.Time `orm:"index"`
ViewCount int64 `orm:"index"`
ReplyCount int64
LastReplyTime time.Time `orm:"index"`
LastReplyUserId int64
}
func FindArticles ¶
func GetArticle ¶
func GetArticles ¶
type ArticleTag ¶
type Category ¶
type Reply ¶
type Reply struct {
Id int64
ArticleId int64
UserName string
Content string `orm:"size(500)"`
Time time.Time
LikeCount int64
QuoteReplyId int64
}
func GetAdminReplies ¶
func GetReplies ¶
func GetReplyById ¶
Click to show internal directories.
Click to hide internal directories.