ListAllPosts 获取所有帖子
(ctx context.Context, pagination domain.Pagination)
| 281 | |
| 282 | // ListAllPosts 获取所有帖子 |
| 283 | func (p *postRepository) ListAllPosts(ctx context.Context, pagination domain.Pagination) ([]domain.Post, error) { |
| 284 | posts, err := p.dao.ListAll(ctx, pagination) |
| 285 | if err != nil { |
| 286 | p.l.Error("获取所有帖子列表失败", zap.Error(err)) |
| 287 | return nil, fmt.Errorf("获取所有帖子列表失败: %w", err) |
| 288 | } |
| 289 | |
| 290 | if len(posts) == 0 { |
| 291 | p.l.Info("没有找到任何帖子") |
| 292 | return []domain.Post{}, nil |
| 293 | } |
| 294 | |
| 295 | return change.FromDomainSlicePost(posts), nil |
| 296 | } |
| 297 | |
| 298 | func (p *postRepository) refreshCache(options ...interface{}) { |
| 299 | payload := job.Payload{ |
nothing calls this directly
no test coverage detected