Documentation
¶
Index ¶
- func CreateArticle(article Article) int
- func CreateComment(comment *Comment) int
- func CreateTag(tag string)
- func CreateUser(user User) int
- func Follow(userid int, followerid int) bool
- func Unfollow(userid int, followerid int) bool
- func UpdateArticleByID(article Article) bool
- func UpdateCommentByID(comment Comment) bool
- func UpdateUserByID(id int, user User) bool
- func UpdateUserIconByID(id int, iconPath string) bool
- type Article
- type ArticleList
- type ArticlePage
- type Comment
- type CommentList
- type Tag
- type User
- type UserDetail
- type UserList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateArticle ¶
func CreateComment ¶
func CreateUser ¶
func UpdateArticleByID ¶
func UpdateCommentByID ¶
func UpdateUserByID ¶
func UpdateUserIconByID ¶
Types ¶
type ArticleList ¶
type ArticleList struct {
ID int `json:"id"`
Author UserList `json:"author"`
AuthorId int `json:"author_id"`
Content string `json:"content"`
Comments []CommentList `json:"comments"`
Title string `json:"title"`
Tags []Tag `json:"tags"`
UpdatedAt time.Time `json:"updated_at"`
}
func GetAllArticles ¶
func GetAllArticles() []ArticleList
func GetArticleByID ¶
func GetArticleByID(id int) *ArticleList
func GetArticleByUserID ¶
func GetArticleByUserID(id int) []ArticleList
func GetArticlesByTag ¶
func GetArticlesByTag(tag string) []ArticleList
type ArticlePage ¶
type ArticlePage struct {
Number int `json: "number"`
Articles []ArticleList `json: "articles"`
}
func GetArticlesPerPage ¶
func GetArticlesPerPage(pageNum int) ArticlePage
type CommentList ¶
type CommentList struct {
ID int `json:"id"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
ArticleID int `json:"article_id"`
Creator UserList `json:"creator"`
CreatorID int `json:"creator_id"`
}
func GetAllCommentsByArticleID ¶
func GetAllCommentsByArticleID(articleID int) []CommentList
type Tag ¶
type Tag struct {
Content string `json: "content"`
}
func GetAllTags ¶
func GetAllTags() []Tag
type User ¶
type User struct {
UserID int `json:"id, omitempty"`
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Followers []int `json:"followers,[]"`
Following []int `json:"following,[]"`
Iconpath string `json:"iconpath"`
}
func GetUserByID ¶
func GetUserByUsername ¶
type UserDetail ¶
type UserDetail struct {
UserID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Followers []int `json:"followers"`
Following []int `json:"following"`
Articles []ArticleList `json:"articles"`
Iconpath string `json:"iconpath"`
}
func GetUserDetailByID ¶
func GetUserDetailByID(id int) *UserDetail
type UserList ¶
type UserList struct {
UserID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Followers []int `json:"followers"`
Following []int `json:"following"`
Iconpath string `json:"iconpath"`
}
func GetUserFollowers ¶
func GetUserFollowing ¶
func GetUserListByID ¶
Click to show internal directories.
Click to hide internal directories.