Documentation ¶
Index ¶
- type IPostDao
- type Post
- type PostDao
- func (d *PostDao) AddLike(ctx context.Context, id string, ip string) error
- func (d *PostDao) DeleteLike(ctx context.Context, id string, ip string) error
- func (d *PostDao) FindByIdAndIp(ctx context.Context, id string, ip string) (*Post, error)
- func (d *PostDao) GetLatest5Posts(ctx context.Context) ([]*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) QueryPostsPage(ctx context.Context, con bson.D, findOptions *options.FindOptions) ([]*Post, int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPostDao ¶
type IPostDao interface { GetLatest5Posts(ctx context.Context) ([]*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 }
type Post ¶
type Post struct { Sug string `bson:"_id"` Author string `bson:"author"` Title string `bson:"title"` Summary string `bson:"summary"` Content string `bson:"content"` CoverImg string `bson:"cover_img"` Category string `bson:"category"` Tags []string `bson:"tags"` Status domain.PostStatus `bson:"status"` Likes []string `bson:"likes"` LikeCount int `bson:"like_count"` CommentCount int `bson:"comment_count"` VisitCount int `bson:"visit_count"` Priority int `bson:"priority"` MetaDescription string `bson:"meta_description"` MetaKeywords string `bson:"meta_keywords"` WordCount int `bson:"word_count"` IsCommentAllowed bool `bson:"is_comment_allowed"` CreateTime int64 `bson:"create_time"` UpdateTime int64 `bson:"update_time"` }
type PostDao ¶
type PostDao struct {
// contains filtered or unexported fields
}
func NewPostDao ¶
func (*PostDao) DeleteLike ¶
func (*PostDao) FindByIdAndIp ¶
func (*PostDao) GetLatest5Posts ¶
func (*PostDao) GetPunishedPostById ¶
func (*PostDao) IncreaseFieldById ¶
Click to show internal directories.
Click to hide internal directories.