MCPcopy Create free account
hub / github.com/git-bug/git-bug / Next

Method Next

bridge/jira/client.go:537–561  ·  view source on GitHub ↗

Next Return the next item in the result set and advance the iterator. Advancing the iterator may require fetching a new page.

()

Source from the content-addressed store, hash-verified

535// Next Return the next item in the result set and advance the iterator.
536// Advancing the iterator may require fetching a new page.
537func (si *SearchIterator) Next() *Issue {
538 if si.Err != nil {
539 return nil
540 }
541
542 issue := si.searchResult.Issues[si.itemIdx]
543 if si.itemIdx+1 < len(si.searchResult.Issues) {
544 // We still have an item left in the currently cached page
545 si.itemIdx++
546 } else {
547 if si.searchResult.IsLastPage() {
548 si.Err = errDone
549 } else {
550 // There are still more pages to fetch, so fetch the next page and
551 // cache it
552 si.searchResult, si.Err = si.client.Search(
553 si.jql, si.pageSize, si.searchResult.NextStartAt())
554 // NOTE(josh): we don't deal with the error now, we just cache it.
555 // HasNext() will return false and the caller can check the error
556 // afterward.
557 si.itemIdx = 0
558 }
559 }
560 return &issue
561}
562
563// IterSearch return an iterator over paginated results for a JQL search
564func (client *Client) IterSearch(jql string, pageSize int) *SearchIterator {

Callers 1

ImportAllMethod · 0.95

Calls 3

SearchMethod · 0.65
IsLastPageMethod · 0.45
NextStartAtMethod · 0.45

Tested by

no test coverage detected