Documentation ¶
Overview ¶
文章模块,大问题应该没有太多就是查询效率和新旧查询代码太多的问题 趁着这次前后端分离需要好好整理一番
Index ¶
- func APIAddPostAction(c *gin.Context)
- func APIGETPost(c *gin.Context)
- func APIGETPostColumns(c *gin.Context)
- func APIGETPosts(c *gin.Context)
- func APIMarkdown(c *gin.Context)
- func AddPost(post *model.Post) (err error)
- func BaseController(c *gin.Context)
- func DeletePostCategory(postID uint64) error
- func EditPost(postID uint64, postTitle string, postContent string, termIDs []uint64) error
- func EditPostCategory(postID uint64, termIDs []uint64) ([]*model.DBPost, error)
- func GETPostsBySQL(sqlStr string) ([]*model.Post, error)
- func GetAllPost() ([]*model.Post, error)
- func GetDeletePost(c *gin.Context)
- func GetEditPost(c *gin.Context)
- func GetPostByID(postID uint64) (post *model.Post, err error)
- func GetPostCategorys(postID uint64) (cats []*model.Category, err error)
- func GetPostDetail(c *gin.Context)
- func GetPostInsert(c *gin.Context)
- func GetPostLabels(postID uint64) (labs []*model.Label, err error)
- func GetPostList(c *gin.Context)
- func GetPosts(catids []uint64, pagination *pagination.Pagination) (*[]model.Post, uint64, error)
- func GetPostsByCategory(catID uint64, postStatus string) ([]*model.Post, error)
- func GetPostsed(cats []uint64, page uint) (posts []*model.Post, err error)
- func InsertInheritPost(postID uint64) (ID uint64, err error)
- func InsertPublishPost(postAuthor uint64, postTitle string, postContent string, termIDs []uint64) (postID uint64, err error)
- func Markdown(content []byte) ([]byte, error)
- func PostAddTerms(id uint64, termIDs []uint64) error
- func PostEditPost(c *gin.Context)
- func PostInsertPost(c *gin.Context)
- func Register()
- type APIGETPostsForm
- type Filter
- type FormAPIAddPost
- type FormAPIMarkdown
- type FormAPIPostComment
- type FormEditPost
- type FormGetEditPost
- type FormPostPost
- type Search
- type SearchPosts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIAddPostAction ¶
APIAddPostAction 保存文章 @since 0.0.1 @since 0.0.22 用事务的形式重写保存文章
func APIMarkdown ¶
APIMarkdown 将 md 转换为 html @since 0.0.3 TODO 如果 util 提供了该方法 需要合并处理
func DeletePostCategory ¶
DeletePostCategory 删除文章分类 @since 0.0.1
func EditPost ¶
EditPost 修改文章 @since 0.0.1
func EditPostCategory ¶
EditPostCategory 编辑文章分类 @since 0.0.1
func GETPostsBySQL ¶
GETPostsBySQL 通过自动生成的 sql 查询文章信息 @since 0.0.4
func GetPostByID ¶
GetPostByID 通过 ID 获取文章 @since 0.0.1
func GetPostCategorys ¶
GetPostCategorys 获取文章的分类标签???关联项 @since 0.0.1
func GetPostLabels ¶
GetPostLabels 获取文章 label @since 0.0.1
func GetPostList ¶
GetPostList 文章列表 @since 0.0.1 @since 0.0.4 改为 VUE
func GetPosts ¶
func GetPosts(catids []uint64, pagination *pagination.Pagination) (*[]model.Post, uint64, error)
@since 0.0.22 catids 是必填项所以这里不设置默认值
func GetPostsByCategory ¶
GetPostsByCategory 通过分类 ID 获取文章 @since 0.0.1
func GetPostsed ¶
GetPosts 查找文章 @since 0.0.1 @since 0.0.12 这个函数只用在取菜单分类了 不是查找文章 所以改为ed used修改后删除
func InsertInheritPost ¶
InsertInheritPost 创建文章版本简易方法 @since 0.0.1
func InsertPublishPost ¶
func InsertPublishPost(postAuthor uint64, postTitle string, postContent string, termIDs []uint64) (postID uint64, err error)
InsertPublishPost 新建文章简易方法 准备删除1022 @since 0.0.1
func PostAddTerms ¶
PostAddTerms 给文章添加分类 @since 0.0.1
Types ¶
type APIGETPostsForm ¶
type APIGETPostsForm struct { pagination.Form CatIDs []uint64 `form:"cat_ids[]"` }
type Filter ¶
type FormAPIAddPost ¶
type FormAPIAddPost struct { Title string `json:"PostTitle" binding:"required"` Content string `json:"PostContent" binding:"required"` Categorys []uint64 `json:"Categorys" binding:"required"` Labels []uint64 `json:"labels"` }
FormAPIAddPost 保存文章的表单 @since 0.0.1 @since 0.0.22 Categorys 首字母改大写
type FormAPIMarkdown ¶
type FormAPIMarkdown struct {
Content string `form:"content"`
}
FormAPIMarkdown 表单 @since 0.0.3
type FormAPIPostComment ¶
type FormAPIPostComment struct { CommentPostID uint64 `form:"comment_post_id" binding:"required"` CommentParent uint64 `form:"comment_parent" ` CommentContent string `form:"comment_content" binding:"required"` UserID uint64 `form:"user_id" binding:"required"` }
FormAPIPostComment 提交评论表单 @since 0.0.1
type FormEditPost ¶
type FormEditPost struct { PostID uint64 `form:"post_id" binding:"required"` PostTitle string `form:"post_title" binding:"required"` PostContent string `form:"post_content" binding:"required"` TermIDs []uint64 `form:"post_term[]" binding:"required"` }
FormEditPost 发布文章表单 @since 0.0.1
type FormGetEditPost ¶
type FormGetEditPost struct {
PostID uint64 `form:"post_id"`
}
FormGetEditPost 表单 @since 0.0.1
type FormPostPost ¶
type FormPostPost struct { PostTitle string `form:"post_title" binding:"required"` PostContent string `form:"post_content" binding:"required"` TermID []uint64 `form:"post_term[]" binding:"required"` }
FormPostPost 发布文章表单 @since 0.0.1
type Search ¶
Search 为 datatable 设计的接口 @since 0.0.4
type SearchPosts ¶
SearchPosts 实现 @since 0.0.4
func (*SearchPosts) BaseQuery ¶
func (s *SearchPosts) BaseQuery() string
BaseQuery 基础查询语句 @since 0.0.4 TODO 已经弃用待删除
func (*SearchPosts) MySQLFilter ¶
func (s *SearchPosts) MySQLFilter() (string, error)
MySQLFilter 查询过滤条件 @since 0.0.4
func (*SearchPosts) SQL ¶
func (s *SearchPosts) SQL(c *gin.Context) (string, error)
SQL 生成查询用 sql @since TODO 已经弃用待删除
func (*SearchPosts) SQLMap ¶
func (s *SearchPosts) SQLMap() map[string]string
SQLMap 字段与数据库字段对应关系 @since 0.0.4