Documentation ¶
Index ¶
- Variables
- func AddRoleInForum(forum_id, user_id int, role string) error
- func CreateComment(comment Comment) (int64, error)
- func CreateFile(file ExtendedFile) (int64, error)
- func CreateForum(forum Forum) (int64, error)
- func CreateHole(hole Hole) (int64, error)
- func CreatePost(post Post) (int64, error)
- func CreateUser(user User) error
- func DeleteRoleInForum(forum_id, user_id int) error
- func Execute(sentence string, args ...interface{}) (int64, error)
- func FindRoleInForum(forum_id, user_id int) (string, error)
- func GetAllAdminsInForum(forum_id int) ([]int, error)
- func GetCoverURL(forumID int) error
- func GetOneUserLikeListByUserID(userID int) ([]int, error)
- func GetPostNumInForum(forum_id int) (int, error)
- func GetSubscribeNumInForum(forum_id int) (int, error)
- func LikeOnePostByUserIDAndPostID(userID int, postID int) error
- func QueryRows(sentence string, args ...interface{}) ([]map[string]string, error)
- func UpdateCover(path string, forumID int) error
- func UpdateRoleInForum(forum_id, user_id int, role string) error
- func UpdateUserAvatarByUserId(userID int, avatar_path string) error
- type Comment
- type CommentDetail
- type ExtendedFile
- type Forum
- type ForumUser
- type Hole
- type HoleDetail
- type Post
- type PostDetail
- type SubscribeList
- type User
- type UserDetail
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *sql.DB
Functions ¶
func AddRoleInForum ¶
将某用户"添加为"某论坛的"user/owner/admin"
func GetAllAdminsInForum ¶
func GetPostNumInForum ¶
func GetSubscribeNumInForum ¶
func UpdateRoleInForum ¶
将某用户在某论坛的角色修改为role
Types ¶
type Comment ¶
type Comment struct { CommentID int `json:"comment_id"` PostID int `json:"post_id"` UserID int `json:"user_id"` UserName string `json:"username"` Content string `json:"content"` CreateAt string `json:"create_at"` }
func GetAllCommentsByPostID ¶
获取给定的 PostID 下的全部 comments
func GetOneCommentByCommentID ¶
根据id获取某个 Comment
type CommentDetail ¶
type CommentDetail struct {
Comment
}
type ExtendedFile ¶
type ExtendedFile struct { FileID int `json:"file_id"` PostID int `json:post_id` FileName string `json:"filename"` Bucket string `json:"bucket"` CreateAt string `json:"create_at"` }
在数据库中存放的 File 类型的定义
func GetFilesByPostID ¶
func GetFilesByPostID(post_id int) ([]ExtendedFile, error)
根据 post_id 获取其相关的 files
type Forum ¶
type Forum struct { ForumID int `json:"forum_id"` ForumName string `json:"forum_name"` IsPublic bool `json:"is_public"` Description string `json:"description"` CreateAt string `json:"create_at"` Cover string `json:"cover"` PostNum int `json:"post_num"` SubscribeNum int `json:"subscribe_num"` AdminList []int `json:"admin_list"` }
type Hole ¶
type Hole struct { HoleID int `json:"hole_id"` ForumID int `json:"forum_id"` UserID int `json:"user_id"` Title string `json:"title"` Content string `json:"content"` CreateAt string `json:"create_at"` }
func GetAllHolesByForumID ¶
获取某个 forum 下的全部 holes
type HoleDetail ¶
type HoleDetail struct {
Hole
}
type Post ¶
type Post struct { PostID int `json:"post_id"` ForumID int `json:"forum_id"` UserID int `json:"user_id"` Title string `json:"title"` Content string `json:"content"` CreateAt string `json:"create_at"` Like int `json:"like"` Username string `json:"username"` }
func GetAllPostsByForumID ¶
获取某个 forum 下的全部 posts
type PostDetail ¶
type PostDetail struct { Post Files []ExtendedFile `json:"files"` }
type SubscribeList ¶
type SubscribeList struct { ParticipateList []int `json:"participate_list"` FocusList []int `json:"star_list"` }
func GetOneUserSubscribe ¶
func GetOneUserSubscribe(userID int) (SubscribeList, error)
根据用户id获取某个用户信息以及所参与的/关注的列表
type User ¶
type User struct { UserId int `json:"user_id"` Username string `json:"username"` Email string `json:"email"` Password string `json:"password"` IsAdmin bool `json:"is_admin"` Avatar string `json:"avatar"` CreateAt string `json:"create_at"` }
func GetAllUsers ¶
func GetAllUsersContains ¶
func GetUserByEmail ¶
type UserDetail ¶
type UserDetail struct { User SubscribeList LikeList []int `json:"like_list"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.