Documentation ¶
Index ¶
- type AdminComment
- type Comment
- type CommentDao
- func (d *CommentDao) AddComment(ctx context.Context, comment *Comment) (string, error)
- func (d *CommentDao) AddCommentReply(ctx context.Context, cmtId string, commentReply Reply) error
- func (d *CommentDao) AggregationQuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]AdminComment, int64, error)
- func (d *CommentDao) CountOfToday(ctx context.Context) (int64, error)
- func (d *CommentDao) DeleteById(ctx context.Context, id string) error
- func (d *CommentDao) DeleteReplyByCIdAndRId(ctx context.Context, commentId string, replyId string) error
- func (d *CommentDao) FindApprovedCommentById(ctx context.Context, cmtId string) (*Comment, error)
- func (d *CommentDao) FindCommentById(ctx context.Context, id string) (*Comment, error)
- func (d *CommentDao) FindCommentWithRepliesById(ctx context.Context, id string) (*Comment, error)
- func (d *CommentDao) FindCommentsByPostIdAndCmtStatus(ctx context.Context, postId string, cmtStatus uint) ([]*Comment, error)
- func (d *CommentDao) FindReplyByCIdAndRId(ctx context.Context, commentId string, replyId string) (*ReplyWithPostInfo, error)
- func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
- func (d *CommentDao) UpdateCommentReplyStatus(ctx context.Context, commentId string, replyId string, ...) error
- func (d *CommentDao) UpdateCommentStatus(ctx context.Context, id string, commentStatus CommentStatus) error
- type CommentStatus
- type ICommentDao
- type LatestComment
- type PostInfo
- type Reply
- type ReplyWithPostInfo
- type UserInfo
- type UserInfo4Comment
- type UserInfo4Reply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminComment ¶
type Comment ¶
type Comment struct { Id string `bson:"_id"` // 文章信息 PostInfo PostInfo `bson:"post_info"` // 评论的内容 Content string `bson:"content"` // 用户信息 UserInfo UserInfo4Comment `bson:"user_info"` // 该评论下的所有回复的内容 Replies []Reply `bson:"replies"` Status CommentStatus `bson:"status"` // 评论时间 CreateTime int64 `bson:"create_time"` // 修改时间 UpdateTime int64 `bson:"update_time"` }
type CommentDao ¶
type CommentDao struct {
// contains filtered or unexported fields
}
func NewCommentDao ¶
func NewCommentDao(db *mongo.Database) *CommentDao
func (*CommentDao) AddComment ¶
func (*CommentDao) AddCommentReply ¶
func (*CommentDao) AggregationQuerySkipAndSetLimit ¶
func (d *CommentDao) AggregationQuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]AdminComment, int64, error)
func (*CommentDao) CountOfToday ¶
func (d *CommentDao) CountOfToday(ctx context.Context) (int64, error)
func (*CommentDao) DeleteById ¶
func (d *CommentDao) DeleteById(ctx context.Context, id string) error
func (*CommentDao) DeleteReplyByCIdAndRId ¶
func (*CommentDao) FindApprovedCommentById ¶
func (*CommentDao) FindCommentById ¶
func (*CommentDao) FindCommentWithRepliesById ¶
func (*CommentDao) FindCommentsByPostIdAndCmtStatus ¶
func (*CommentDao) FindReplyByCIdAndRId ¶
func (d *CommentDao) FindReplyByCIdAndRId(ctx context.Context, commentId string, replyId string) (*ReplyWithPostInfo, error)
func (*CommentDao) FineLatestCommentAndReply ¶
func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
func (*CommentDao) UpdateCommentReplyStatus ¶
func (d *CommentDao) UpdateCommentReplyStatus(ctx context.Context, commentId string, replyId string, commentStatus CommentStatus) error
func (*CommentDao) UpdateCommentStatus ¶
func (d *CommentDao) UpdateCommentStatus(ctx context.Context, id string, commentStatus CommentStatus) error
type CommentStatus ¶
type CommentStatus uint
const ( // CommentStatusPending 审核中 CommentStatusPending CommentStatus = iota // CommentStatusApproved 审核通过 CommentStatusApproved // CommentStatusHidden 隐藏 CommentStatusHidden // CommentStatusRejected 审核不通过 CommentStatusRejected )
type ICommentDao ¶
type ICommentDao interface { AddComment(ctx context.Context, comment *Comment) (string, error) FindApprovedCommentById(ctx context.Context, cmtId string) (*Comment, error) AddCommentReply(ctx context.Context, cmtId string, commentReply Reply) error FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error) FindCommentsByPostIdAndCmtStatus(ctx context.Context, postId string, cmtStatus uint) ([]*Comment, error) AggregationQuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]AdminComment, int64, error) FindCommentById(ctx context.Context, id string) (*Comment, error) UpdateCommentStatus(ctx context.Context, id string, commentStatus CommentStatus) error FindReplyByCIdAndRId(ctx context.Context, commentId string, replyId string) (*ReplyWithPostInfo, error) UpdateCommentReplyStatus(ctx context.Context, commentId string, replyId string, commentStatus CommentStatus) error FindCommentWithRepliesById(ctx context.Context, id string) (*Comment, error) DeleteById(ctx context.Context, id string) error DeleteReplyByCIdAndRId(ctx context.Context, commentId string, replyId string) error CountOfToday(ctx context.Context) (int64, error) }
type LatestComment ¶
type Reply ¶
type Reply struct { ReplyId string `bson:"reply_id"` // 回复内容 Content string `bson:"content"` // 被回复的回复 Id ReplyToId string `bson:"reply_to_id"` // 用户信息 UserInfo UserInfo4Reply `bson:"user_info"` // 被回复用户的信息 RepliedUserInfo UserInfo4Reply `bson:"replied_user_info"` Status CommentStatus `bson:"status"` // 回复时间 CreateTime int64 `bson:"create_time"` // 修改时间 UpdateTime int64 `bson:"update_time"` }
type ReplyWithPostInfo ¶
type UserInfo4Comment ¶
type UserInfo4Comment UserInfo
type UserInfo4Reply ¶
type UserInfo4Reply UserInfo
Click to show internal directories.
Click to hide internal directories.