ListComments 列出评论
(ctx context.Context, postId int64, minId, limit int64)
| 94 | |
| 95 | // ListComments 列出评论 |
| 96 | func (c *commentRepository) ListComments(ctx context.Context, postId int64, minId, limit int64) ([]domain.Comment, error) { |
| 97 | // 获取评论列表 |
| 98 | daoComments, err := c.dao.FindCommentsByPostId(ctx, postId, minId, limit) |
| 99 | if err != nil { |
| 100 | return nil, fmt.Errorf("获取评论列表失败: %w", err) |
| 101 | } |
| 102 | |
| 103 | return c.toDomainSliceComments(daoComments), nil |
| 104 | } |
| 105 | |
| 106 | // toDAOComment 将领域模型评论转换为DAO评论 |
| 107 | func (c *commentRepository) toDAOComment(comment domain.Comment) dao.Comment { |
nothing calls this directly
no test coverage detected