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

Method Next

bridge/jira/client.go:867–891  ·  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

865// Next Return the next item in the result set and advance the iterator.
866// Advancing the iterator may require fetching a new page.
867func (cli *ChangeLogIterator) Next() *ChangeLogEntry {
868 if cli.Err != nil {
869 return nil
870 }
871
872 item := cli.message.Entries[cli.itemIdx]
873 if cli.itemIdx+1 < len(cli.message.Entries) {
874 // We still have an item left in the currently cached page
875 cli.itemIdx++
876 } else {
877 if cli.message.IsLastPage() {
878 cli.Err = errDone
879 } else {
880 // There are still more pages to fetch, so fetch the next page and
881 // cache it
882 cli.message, cli.Err = cli.client.GetChangeLog(
883 cli.idOrKey, cli.pageSize, cli.message.NextStartAt())
884 // NOTE(josh): we don't deal with the error now, we just cache it.
885 // HasNext() will return false and the caller can check the error
886 // afterward.
887 cli.itemIdx = 0
888 }
889 }
890 return &item
891}
892
893// IterChangeLog returns an iterator over entries in the changelog for an issue
894func (client *Client) IterChangeLog(idOrKey string, pageSize int) *ChangeLogIterator {

Callers 1

ImportAllMethod · 0.95

Calls 3

GetChangeLogMethod · 0.80
IsLastPageMethod · 0.45
NextStartAtMethod · 0.45

Tested by

no test coverage detected