Documentation ¶
Index ¶
- 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 CommentReply) error
- func (d *CommentDao) FindCommentById(ctx context.Context, cmtId string) (*Comment, error)
- func (d *CommentDao) FindCommentsByPostIdAndCmtStatus(ctx context.Context, postId string, cmtStatus uint) ([]*Comment, error)
- func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
- type CommentReply
- type CommentStatus
- type ICommentDao
- type LatestComment
- type PostInfo4Comment
- type UserInfo4Comment
- type UserInfo4Reply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { Id string `bson:"_id"` // 文章信息 PostInfo PostInfo4Comment `bson:"post_info"` // 评论的内容 Content string `bson:"content"` // 用户信息 UserInfo UserInfo4Comment `bson:"user_info"` // 该评论下的所有回复的内容 Replies []CommentReply `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 (d *CommentDao) AddCommentReply(ctx context.Context, cmtId string, commentReply CommentReply) error
func (*CommentDao) FindCommentById ¶
func (*CommentDao) FindCommentsByPostIdAndCmtStatus ¶
func (*CommentDao) FineLatestCommentAndReply ¶
func (d *CommentDao) FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error)
type CommentReply ¶
type CommentReply 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 CommentStatus ¶
type CommentStatus uint
const ( // CommentStatusPending 审核中 CommentStatusPending CommentStatus = iota // CommentStatusApproved 审核通过 CommentStatusApproved // CommentStatusRejected 审核不通过 CommentStatusRejected )
type ICommentDao ¶
type ICommentDao interface { AddComment(ctx context.Context, comment Comment) (string, error) FindCommentById(ctx context.Context, cmtId string) (*Comment, error) AddCommentReply(ctx context.Context, cmtId string, commentReply CommentReply) error FineLatestCommentAndReply(ctx context.Context, cnt int) ([]LatestComment, error) FindCommentsByPostIdAndCmtStatus(ctx context.Context, postId string, cmtStatus uint) ([]*Comment, error) }
type LatestComment ¶
type LatestComment struct { PostInfo4Comment `bson:"post_info"` Name string `bson:"name"` Content string `bson:"content"` CreateTime int64 `bson:"create_time"` }
type PostInfo4Comment ¶
type UserInfo4Comment ¶
type UserInfo4Reply ¶
type UserInfo4Reply UserInfo4Comment
Click to show internal directories.
Click to hide internal directories.