Back to godoc.org

Package post

v0.0.25
Latest Go to latest

The highest tagged major version is .

Published: Nov 27, 2019 | Licenses: Apache-2.0 , Apache-2.0 | Module: cloudtui.com/key/xiao

Overview

文章模块,大问题应该没有太多就是查询效率和新旧查询代码太多的问题 趁着这次前后端分离需要好好整理一番

Index

func APIAddPostAction

func APIAddPostAction(c *gin.Context)

APIAddPostAction 保存文章 @since 0.0.1 @since 0.0.22 用事务的形式重写保存文章

func APIGETPost

func APIGETPost(c *gin.Context)

@since 0.0.25

func APIGETPostColumns

func APIGETPostColumns(c *gin.Context)

返回表格的表格字段

func APIGETPosts

func APIGETPosts(c *gin.Context)

APIGETPosts 获取全部文章 @since 0.0.4

func APIMarkdown

func APIMarkdown(c *gin.Context)

APIMarkdown 将 md 转换为 html @since 0.0.3 TODO 如果 util 提供了该方法 需要合并处理

func AddPost

func AddPost(post *model.Post) (err error)

AddPost 使用事务添加文章 @since 0.0.1

func BaseController

func BaseController(c *gin.Context)

BaseController 基础数据路由 @since 0.0.1

func DeletePostCategory

func DeletePostCategory(postID uint64) error

DeletePostCategory 删除文章分类 @since 0.0.1

func EditPost

func EditPost(postID uint64, postTitle string, postContent string, termIDs []uint64) error

EditPost 修改文章 @since 0.0.1

func EditPostCategory

func EditPostCategory(postID uint64, termIDs []uint64) ([]*model.DBPost, error)

EditPostCategory 编辑文章分类 @since 0.0.1

func GETPostsBySQL

func GETPostsBySQL(sqlStr string) ([]*model.Post, error)

GETPostsBySQL 通过自动生成的 sql 查询文章信息 @since 0.0.4

func GetAllPost

func GetAllPost() ([]*model.Post, error)

GetAllPost 获取所有文章 @since 0.0.1

func GetDeletePost

func GetDeletePost(c *gin.Context)

GetDeletePost 删除文章 @since 0.0.1

func GetEditPost

func GetEditPost(c *gin.Context)

GetEditPost 编辑文章 @since 0.0.1

func GetPostByID

func GetPostByID(postID uint64) (post *model.Post, err error)

GetPostByID 通过 ID 获取文章 @since 0.0.1

func GetPostCategorys

func GetPostCategorys(postID uint64) (cats []*model.Category, err error)

GetPostCategorys 获取文章的分类标签???关联项 @since 0.0.1

func GetPostDetail

func GetPostDetail(c *gin.Context)

GetPostDetail 查看具体文章 @since 0.0.1

func GetPostInsert

func GetPostInsert(c *gin.Context)

GetPostInsert 发布文章页 @since 0.0.1

func GetPostLabels

func GetPostLabels(postID uint64) (labs []*model.Label, err error)

GetPostLabels 获取文章 label @since 0.0.1

func GetPostList

func GetPostList(c *gin.Context)

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

func GetPostsByCategory(catID uint64, postStatus string) ([]*model.Post, error)

GetPostsByCategory 通过分类 ID 获取文章 @since 0.0.1

func GetPostsed

func GetPostsed(cats []uint64, page uint) (posts []*model.Post, err error)

GetPosts 查找文章 @since 0.0.1 @since 0.0.12 这个函数只用在取菜单分类了 不是查找文章 所以改为ed used修改后删除

func InsertInheritPost

func InsertInheritPost(postID uint64) (ID uint64, err error)

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 Markdown

func Markdown(content []byte) ([]byte, error)

Markdown 将 md 转换为 html @since 0.0.3

func PostAddTerms

func PostAddTerms(id uint64, termIDs []uint64) error

PostAddTerms 给文章添加分类 @since 0.0.1

func PostEditPost

func PostEditPost(c *gin.Context)

PostEditPost 编辑文章 @since 0.0.1

func PostInsertPost

func PostInsertPost(c *gin.Context)

PostInsertPost 添加文章

@since 0.0.1

func Register

func Register()

Register 注册文章组件路由 @since 0.0.1

type APIGETPostsForm

type APIGETPostsForm struct {
	pagination.Form
	CatIDs []uint64 `form:"cat_ids[]"`
}

type Filter

type Filter struct {
	A            string // A
	Condition    string // 条件
	B            string // B
	Relationship string // 关系  and / or
}

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 interface {
	SQLMap() map[string]string
}

Search 为 datatable 设计的接口 @since 0.0.4

type SearchPosts

type SearchPosts struct {
	ID    uint64
	Title string
}

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

Package Files

  • api_post.go
  • c_post.go
  • m_post.go
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier