iterator

package module
v0.0.0-...-13b37e7 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

Iterator

Build Status Go Report Card Taylor Swift Volkswagen License

Docs

You can find the documentation hosted on godoc.org.

Install

go get github.com/andersnormal/iterator

Benchmarks

License

Apache 2.0

Documentation

Overview

Package iterator is a simple implementation of a page iterator. Which also encodes page tokens for easily walk for results.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPositiveSize   = errors.New("iterator: page size must be positive")
	ErrBufferNotEmpty = errors.New("pager: must call NextPage with an empty buffer")
	ErrNilNextPage    = errors.New("pager: nil passed to Pager.NextPage")
)

Functions

This section is empty.

Types

type Iterator

type Iterator struct {
	MaxSize int
	Token   string
	// contains filtered or unexported fields
}

Iterator represents the state of an iterator

func NewIterator

func NewIterator(retrieve func(int, string) (string, error), bufLen func() int, retrieveBuf func() interface{}) (*Iterator, func() error)

func (*Iterator) Len

func (i *Iterator) Len() int

type Pageable

type Pageable interface {
	Iterator() *Iterator
}

Pageable is implemented by iterators that support paging.

type Pager

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

func NewPager

func NewPager(iter Pageable, size int, token string) *Pager

func (*Pager) NextPage

func (p *Pager) NextPage(ptr interface{}) (string, error)

Jump to

Keyboard shortcuts

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