Documentation
¶
Index ¶
- type Category4Post
- type IPostDao
- type Post
- type PostDao
- func (d *PostDao) AddLike(ctx context.Context, id string, ip string) error
- func (d *PostDao) AddPost(ctx context.Context, post *Post) error
- func (d *PostDao) DecreaseByField(ctx context.Context, id string, filedName string, cnt int) error
- func (d *PostDao) DeleteById(ctx context.Context, id string) error
- func (d *PostDao) DeleteLike(ctx context.Context, id string, ip string) error
- func (d *PostDao) FindById(ctx context.Context, id string) (*Post, error)
- func (d *PostDao) FindByIdAndIp(ctx context.Context, id string, ip string) (*Post, error)
- func (d *PostDao) FindDisplayedPosts(ctx context.Context) ([]*Post, error)
- func (d *PostDao) GetFrontPosts(ctx context.Context, count int64) ([]*Post, error)
- func (d *PostDao) GetPunishedPostById(ctx context.Context, id string) (*Post, error)
- func (d *PostDao) IncreaseFieldById(ctx context.Context, id string, field string) error
- func (d *PostDao) IncreasePostLikeCount(ctx context.Context, postId string) error
- func (d *PostDao) QueryPostsPage(ctx context.Context, con bson.D, findOptions *options.FindOptions) ([]*Post, int64, error)
- func (d *PostDao) SavePost(ctx context.Context, post *Post) error
- func (d *PostDao) UpdateIsCommentAllowedById(ctx context.Context, id string, isCommentAllowed bool) error
- func (d *PostDao) UpdateIsDisplayedById(ctx context.Context, id string, isDisplayed bool) error
- type Tag4Post
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category4Post ¶
type IPostDao ¶
type IPostDao interface { GetFrontPosts(ctx context.Context, count int64) ([]*Post, error) QueryPostsPage(ctx context.Context, con bson.D, findOptions *options.FindOptions) ([]*Post, int64, error) GetPunishedPostById(ctx context.Context, sug string) (*Post, error) FindByIdAndIp(ctx context.Context, sug string, ip string) (*Post, error) AddLike(ctx context.Context, sug string, ip string) error DeleteLike(ctx context.Context, sug string, ip string) error IncreaseFieldById(ctx context.Context, id string, field string) error AddPost(ctx context.Context, post *Post) error DeleteById(ctx context.Context, id string) error FindById(ctx context.Context, id string) (*Post, error) DecreaseByField(ctx context.Context, id string, filedName string, cnt int) error SavePost(ctx context.Context, post *Post) error UpdateIsDisplayedById(ctx context.Context, id string, isDisplayed bool) error UpdateIsCommentAllowedById(ctx context.Context, id string, isCommentAllowed bool) error IncreasePostLikeCount(ctx context.Context, postId string) error FindDisplayedPosts(ctx context.Context) ([]*Post, error) }
type Post ¶
type Post struct { Id string `bson:"_id"` Author string `bson:"author"` Title string `bson:"title"` Summary string `bson:"summary"` Content string `bson:"content"` CoverImg string `bson:"cover_img"` Categories []Category4Post `bson:"categories"` Tags []Tag4Post `bson:"tags"` IsDisplayed bool `bson:"is_displayed"` LikeCount int `bson:"like_count,omitempty"` CommentCount int `bson:"comment_count,omitempty"` VisitCount int `bson:"visit_count,omitempty"` StickyWeight int `bson:"sticky_weight"` MetaDescription string `bson:"meta_description"` MetaKeywords string `bson:"meta_keywords"` WordCount int `bson:"word_count"` IsCommentAllowed bool `bson:"is_comment_allowed"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` }
type PostDao ¶
type PostDao struct {
// contains filtered or unexported fields
}
func NewPostDao ¶
func (*PostDao) DecreaseByField ¶
func (*PostDao) DeleteLike ¶
func (*PostDao) FindByIdAndIp ¶
func (*PostDao) FindDisplayedPosts ¶
func (*PostDao) GetFrontPosts ¶
func (*PostDao) GetPunishedPostById ¶
func (*PostDao) IncreaseFieldById ¶
func (*PostDao) IncreasePostLikeCount ¶
func (*PostDao) QueryPostsPage ¶
func (*PostDao) UpdateIsCommentAllowedById ¶
Click to show internal directories.
Click to hide internal directories.