MCPcopy Index your code
hub / github.com/google/go-github / ListIter

Method ListIter

github/github-iterators.go:5526–5554  ·  view source on GitHub ↗

ListIter returns an iterator that paginates through all results of List.

(ctx context.Context, user string, opts *RepositoryListOptions)

Source from the content-addressed store, hash-verified

5524
5525// ListIter returns an iterator that paginates through all results of List.
5526func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *RepositoryListOptions) iter.Seq2[*Repository, error] {
5527 return func(yield func(*Repository, error) bool) {
5528 // Create a copy of opts to avoid mutating the caller's struct
5529 if opts == nil {
5530 opts = &RepositoryListOptions{}
5531 } else {
5532 opts = Ptr(*opts)
5533 }
5534
5535 for {
5536 results, resp, err := s.List(ctx, user, opts)
5537 if err != nil {
5538 yield(nil, err)
5539 return
5540 }
5541
5542 for _, item := range results {
5543 if !yield(item, nil) {
5544 return
5545 }
5546 }
5547
5548 if resp.NextPage == 0 {
5549 break
5550 }
5551 opts.ListOptions.Page = resp.NextPage
5552 }
5553 }
5554}
5555
5556// ListAllTopicsIter returns an iterator that paginates through all results of ListAllTopics.
5557func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[string, error] {

Callers

nothing calls this directly

Calls 2

ListMethod · 0.95
PtrFunction · 0.70

Tested by

no test coverage detected