model

package
v0.0.0-...-d4b0e85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EndOfList = fmt.Errorf("EndOfList")

Functions

func NewClient

func NewClient(ctx context.Context, cwd string) (*github.Client, error)

NewClient returns a new Github client that uses the same credentials as the `gh` Github command line client.

Types

type ListGenerator

type ListGenerator[ItemType any] struct {
	// Retrieve should call the github client with the provided ListOptions
	// to retrieve the next page.
	Retrieve func(github.ListOptions) ([]*ItemType, *github.Response, error)
	// contains filtered or unexported fields
}

ListGenerator handles logic for iterating through github client paged lists.

func (*ListGenerator[GithubType]) HasNext

func (g *ListGenerator[GithubType]) HasNext() bool

HasNext Returns true when the next item in the list exists.

func (*ListGenerator[GithubType]) Next

func (g *ListGenerator[GithubType]) Next() (*GithubType, error)

Next returns the next item in the list or error if the next page cannot be retrieved or there are no more items.

type PagedListGenerator

type PagedListGenerator[GithubType any, ItemType any] struct {
	// Retrieve should call the github client with the provided ListOptions
	// to retrieve the next page.
	Retrieve func(github.ListOptions) (*GithubType, []*ItemType, *github.Response, error)
	// contains filtered or unexported fields
}

PagedListGenerator handles logic for iterating through a Github Client paged list where your code needs both the page object and the item object. GithubType is the page object, ItemType is the item object.

func (*PagedListGenerator[GithubType, ItemType]) HasNext

func (g *PagedListGenerator[GithubType, ItemType]) HasNext() bool

HasNext returns true when there are more items in the list.

func (*PagedListGenerator[GithubType, ItemType]) Next

func (g *PagedListGenerator[GithubType, ItemType]) Next() (*GithubType, *ItemType, error)

Next returns a pointer the next item in the list, along with a pointer to the current page. Returns error when the end of the list is reached, or when there was a problem retrieving the next page.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL