post

package
v0.0.0-...-3d8f939 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PostDraft means the post is in draft phase
	PostDraft = 1
	// PostPublished means the post already published
	PostPublished = 2
	// PostDelete means the post has been deleted
	PostDelete = 3
)
View Source
const (
	// OpCommentLike means a user like a comment
	OpCommentLike = 1
	// OpCommentDislike means a user dislike a comment
	OpCommentDislike = 2

	// OpPostLike means a user like a post
	OpPostLike = 1
	// OpPostDislike means a user dislike a post
	OpPostDislike = 2
)
View Source
const (
	// OpUpdate is the update operation
	OpUpdate = 1
	// OpDelete is the delete operation
	OpDelete = 2
)
View Source
const (
	// StatusNormal means post is in normal status
	StatusNormal = 0
	// StatusDeleted means post is deleted
	StatusDeleted = 1
)
View Source
const (
	// ArticleType means the post is an ariticle
	ArticleType = 1
)

Variables

This section is empty.

Functions

func ArticleLike

func ArticleLike(c echo.Context) error

ArticleLike means a user like this article

func BeforeEditAr

func BeforeEditAr(c echo.Context) error

BeforeEditAr deal some pre-things before editing article

func Comment

func Comment(c echo.Context) error

Comment is the action that user make commention to one post

func CommentDislike

func CommentDislike(c echo.Context) error

CommentDislike indicates that a user dislike a Comment

func CommentLike

func CommentLike(c echo.Context) error

CommentLike indicates that a user like/dislike a Comment

func CommentReply

func CommentReply(c echo.Context) error

CommentReply is the action that user make commention to one post

func DeleteComment

func DeleteComment(c echo.Context) error

DeleteComment delete the comment Only comment author can do this

func EditComment

func EditComment(c echo.Context) error

EditComment edit the comment

func GetArticleDetail

func GetArticleDetail(c echo.Context) error

GetArticleDetail return detail data of the article

func NewArticle

func NewArticle(c echo.Context) error

NewArticle create a new article

func Preview

func Preview(c echo.Context) error

Preview return the new review html of article

func QueryComments

func QueryComments(c echo.Context) error

QueryComments return the comments by post id

func RevertComment

func RevertComment(c echo.Context) error

RevertComment revert the comment from delete status Only comment owner and post author can do this

func SaveArticleChanges

func SaveArticleChanges(c echo.Context) error

SaveArticleChanges save changes when edit article

Types

type ArContent

type ArContent struct {
	ID         string   `json:"id"`
	Title      string   `json:"title"`
	Tags       []string `json:"tags"`
	MD         string   `json:"md"`
	Render     string   `json:"render"`
	Lang       string   `json:"lang"`
	Status     int      `json:"status"`
	CoverImage string   `json:"cover_image"`
}

ArContent represent article content

type ArticleDetail

type ArticleDetail struct {
	ID          string   `json:"id"`
	UID         string   `json:"uid"`
	Title       string   `json:"title"`
	Tags        []string `json:"tags"`
	Render      string   `json:"render"`
	Status      int      `json:"status"`
	PublishDate string   `json:"publish_date"`
	EditDate    string   `json:"edit_date"`
	Lang        string   `json:"lang"`
	Words       int      `json:"words"`
	Likes       int      `json:"likes"` // all likes of this article
	Liked       bool     `json:"liked"` // current user liked this article
	CoverImage  string   `json:"cover_image"`
	// contains filtered or unexported fields
}

ArticleDetail contains detail data of article

type CommentContent

type CommentContent struct {
	ID          string `json:"id"`
	PID         string `json:"pid"`
	Depth       int    `json:"depth"`
	MD          string `json:"md"`
	Render      string `json:"render"`
	UID         string `json:"uid"`
	UName       string `json:"uname"`
	UNickname   string `json:"unickname"`
	PublishDate string `json:"date"`

	EditDate string `json:"edit_date,omitempty"`

	Likes int `json:"likes"`
	Liked int `json:"liked"` // current login user's liked to the comment, 0 normal, 1 liked, 2 disliked

	Status int `json:"status"`
	// contains filtered or unexported fields
}

CommentContent holds the comment content

type Comments

type Comments []*CommentContent

Comments is the list of comment

func (Comments) Len

func (a Comments) Len() int

func (Comments) Less

func (a Comments) Less(i, j int) bool

func (Comments) Swap

func (a Comments) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL