iter

package
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iter

type Iter struct {
	// contains filtered or unexported fields
}

Iter provides a convenient interface for iterating over the elements returned from paginated list API calls. Successive calls to the Next method will step through each item in the list. Iterators are not thread-safe, so they should not be consumed across multiple goroutines.

func New

func New(qs *form.Values, query Query) *Iter

New returns a new instance of Iter for a given query and its options.

func NewE

func NewE(e error) *Iter

NewE returns a iter wrapping an error.

func (*Iter) Count

func (it *Iter) Count() int

Count returns the list count.

func (*Iter) Current

func (it *Iter) Current() interface{}

Current returns the most recent item visited by a call to Next.

func (*Iter) Err

func (it *Iter) Err() error

Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.

func (*Iter) Meta

func (it *Iter) Meta() interface{}

Meta returns the the meta data associated with the query.

func (*Iter) Next

func (it *Iter) Next() bool

Next advances the Iter to the next item in the list, which will then be available through the Current method. It returns false when the iterator stops at the end of the list.

type Query

type Query = func(*form.Values) (interface{}, []interface{}, error)

Query is the function used to get a response listing.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL