MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / ListAllPosts

Method ListAllPosts

internal/repository/post.go:283–296  ·  view source on GitHub ↗

ListAllPosts 获取所有帖子

(ctx context.Context, pagination domain.Pagination)

Source from the content-addressed store, hash-verified

281
282// ListAllPosts 获取所有帖子
283func (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
298func (p *postRepository) refreshCache(options ...interface{}) {
299 payload := job.Payload{

Callers

nothing calls this directly

Calls 2

FromDomainSlicePostFunction · 0.92
ListAllMethod · 0.65

Tested by

no test coverage detected