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

Method ListTeamsIter

github/github-iterators.go:7165–7193  ·  view source on GitHub ↗

ListTeamsIter returns an iterator that paginates through all results of ListTeams.

(ctx context.Context, org string, opts *ListOptions)

Source from the content-addressed store, hash-verified

7163
7164// ListTeamsIter returns an iterator that paginates through all results of ListTeams.
7165func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Team, error] {
7166 return func(yield func(*Team, error) bool) {
7167 // Create a copy of opts to avoid mutating the caller's struct
7168 if opts == nil {
7169 opts = &ListOptions{}
7170 } else {
7171 opts = Ptr(*opts)
7172 }
7173
7174 for {
7175 results, resp, err := s.ListTeams(ctx, org, opts)
7176 if err != nil {
7177 yield(nil, err)
7178 return
7179 }
7180
7181 for _, item := range results {
7182 if !yield(item, nil) {
7183 return
7184 }
7185 }
7186
7187 if resp.NextPage == 0 {
7188 break
7189 }
7190 opts.Page = resp.NextPage
7191 }
7192 }
7193}
7194
7195// ListUserTeamsIter returns an iterator that paginates through all results of ListUserTeams.
7196func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Team, error] {

Calls 2

ListTeamsMethod · 0.95
PtrFunction · 0.70