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, objectID primitive.ObjectID, 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, objectID primitive.ObjectID) error
- func (d *CommentDao) DeleteByIds(ctx context.Context, ids []primitive.ObjectID) error
- func (d *CommentDao) DeleteManyByPostId(ctx context.Context, postId string) error
- func (d *CommentDao) DeleteReplyByCIdAndRId(ctx context.Context, objectID primitive.ObjectID, replyId string) error
- func (d *CommentDao) Find(ctx context.Context, findOptions *options.FindOptions) ([]*Comment, int64, error)
- func (d *CommentDao) FindApprovedCommentById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error)
- func (d *CommentDao) FindApprovedCommentsByPostId(ctx context.Context, postId string) ([]*Comment, error)
- func (d *CommentDao) FindByAggregation(ctx context.Context, pipeline mongo.Pipeline) ([]*Comment, error)
- func (d *CommentDao) FindByObjectIDs(ctx context.Context, ids []primitive.ObjectID) ([]*Comment, error)
- func (d *CommentDao) FindCommentById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error)
- func (d *CommentDao) FindCommentWithRepliesById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error)
- func (d *CommentDao) FindCommentsByPostId(ctx context.Context, postId string) ([]*Comment, error)
- func (d *CommentDao) FindDisapprovedCommentByObjectIDs(ctx context.Context, commentObjectIDs []primitive.ObjectID) ([]*Comment, error)
- func (d *CommentDao) FindReplyByCIdAndRId(ctx context.Context, objectCommentID primitive.ObjectID, replyId string) (*ReplyWithPostInfo, error)
- func (d *CommentDao) FindWithDisapprovedReplyByCidAndRIds(ctx context.Context, commentObjID primitive.ObjectID, replyIds []string) (*Comment, error)
- func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
- func (d *CommentDao) PullReplyByCIdAndRIds(ctx context.Context, commentObjID primitive.ObjectID, replyIds []string) error
- func (d *CommentDao) UpdateCReplyStatus2TrueByCidAndRIds(ctx context.Context, commentObjectID primitive.ObjectID, replyIds []string) error
- func (d *CommentDao) UpdateCommentReplyStatus(ctx context.Context, objectID primitive.ObjectID, replyId string, ...) error
- func (d *CommentDao) UpdateCommentStatus2True(ctx context.Context, objectID primitive.ObjectID) error
- func (d *CommentDao) UpdateCommentStatus2TrueByIds(ctx context.Context, ids []primitive.ObjectID) error
- 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 { mongox.Model `bson:",inline"` // 文章信息 PostInfo PostInfo `bson:"post_info"` // 评论的内容 Content string `bson:"content"` // 用户信息 UserInfo UserInfo4Comment `bson:"user_info"` // 该评论下的所有回复的内容 Replies []Reply `bson:"replies"` ApprovalStatus bool `bson:"approval_status"` }
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 (*CommentDao) DeleteByIds ¶
func (*CommentDao) DeleteManyByPostId ¶
func (d *CommentDao) DeleteManyByPostId(ctx context.Context, postId string) error
func (*CommentDao) DeleteReplyByCIdAndRId ¶
func (*CommentDao) Find ¶
func (d *CommentDao) Find(ctx context.Context, findOptions *options.FindOptions) ([]*Comment, int64, error)
func (*CommentDao) FindApprovedCommentById ¶
func (*CommentDao) FindApprovedCommentsByPostId ¶
func (*CommentDao) FindByAggregation ¶
func (*CommentDao) FindByObjectIDs ¶
func (*CommentDao) FindCommentById ¶
func (*CommentDao) FindCommentWithRepliesById ¶
func (*CommentDao) FindCommentsByPostId ¶
func (*CommentDao) FindDisapprovedCommentByObjectIDs ¶
func (*CommentDao) FindReplyByCIdAndRId ¶
func (d *CommentDao) FindReplyByCIdAndRId(ctx context.Context, objectCommentID primitive.ObjectID, replyId string) (*ReplyWithPostInfo, error)
func (*CommentDao) FindWithDisapprovedReplyByCidAndRIds ¶
func (*CommentDao) FineLatestCommentAndReply ¶
func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
func (*CommentDao) PullReplyByCIdAndRIds ¶
func (*CommentDao) UpdateCReplyStatus2TrueByCidAndRIds ¶
func (*CommentDao) UpdateCommentReplyStatus ¶
func (*CommentDao) UpdateCommentStatus2True ¶
func (*CommentDao) UpdateCommentStatus2TrueByIds ¶
type ICommentDao ¶
type ICommentDao interface { AddComment(ctx context.Context, comment *Comment) (string, error) FindApprovedCommentById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error) AddCommentReply(ctx context.Context, objectID primitive.ObjectID, commentReply Reply) error FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error) FindApprovedCommentsByPostId(ctx context.Context, postId string) ([]*Comment, error) AggregationQuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]AdminComment, int64, error) FindCommentById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error) UpdateCommentStatus2True(ctx context.Context, objectID primitive.ObjectID) error FindReplyByCIdAndRId(ctx context.Context, objectCommentID primitive.ObjectID, replyId string) (*ReplyWithPostInfo, error) UpdateCommentReplyStatus(ctx context.Context, objectID primitive.ObjectID, replyId string, commentStatus bool) error FindCommentWithRepliesById(ctx context.Context, objectID primitive.ObjectID) (*Comment, error) DeleteById(ctx context.Context, objectID primitive.ObjectID) error DeleteReplyByCIdAndRId(ctx context.Context, objectID primitive.ObjectID, replyId string) error CountOfToday(ctx context.Context) (int64, error) Find(ctx context.Context, findOptions *options.FindOptions) ([]*Comment, int64, error) UpdateCommentStatus2TrueByIds(ctx context.Context, ids []primitive.ObjectID) error FindByObjectIDs(ctx context.Context, ids []primitive.ObjectID) ([]*Comment, error) UpdateCReplyStatus2TrueByCidAndRIds(ctx context.Context, commentObjectID primitive.ObjectID, replyIds []string) error FindWithDisapprovedReplyByCidAndRIds(ctx context.Context, commentObjID primitive.ObjectID, replyIds []string) (*Comment, error) FindDisapprovedCommentByObjectIDs(ctx context.Context, commentObjectIDs []primitive.ObjectID) ([]*Comment, error) FindByAggregation(ctx context.Context, pipeline mongo.Pipeline) ([]*Comment, error) DeleteByIds(ctx context.Context, ids []primitive.ObjectID) error PullReplyByCIdAndRIds(ctx context.Context, commentId primitive.ObjectID, replyIds []string) error DeleteManyByPostId(ctx context.Context, postId string) error FindCommentsByPostId(ctx context.Context, postId string) ([]*Comment, 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"` ApprovalStatus bool `bson:"approval_status"` // 回复时间 CreatedAt time.Time `bson:"created_at"` // 修改时间 UpdatedAt time.Time `bson:"updated_at"` }
type ReplyWithPostInfo ¶
type UserInfo4Comment ¶
type UserInfo4Comment UserInfo
type UserInfo4Reply ¶
type UserInfo4Reply UserInfo
Click to show internal directories.
Click to hide internal directories.