pagination

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ResultKind = "PageInfo"

ResultKind represents the result object kind.

Variables

This section is empty.

Functions

func CalculatePageSize

func CalculatePageSize(c Calculation) int

CalculatePageSize calculates the desired page size for paginated queries.

Types

type Calculation

type Calculation struct {
	// GotItems is how many items we currently have received.
	GotItems int
	// MaxItems is how many items we want in total.
	MaxItems int
	// MaxPageSize is the maximum number of items we want to query for per request.
	MaxPageSize int
}

Calculation contains all the info needed to calculate a request's page size.

type Result

type Result struct {
	Kind          string `json:"kind"`
	Message       string `json:"message"`
	NextPageToken Token  `json:"next_page_token"`
	FullCommand   string `json:"full_command"`
}

Result is a printable object that shows the pagination kind. Implements the types.Object interface as a noop.

func (*Result) Description

func (r *Result) Description() string

Description returns an empty description.

func (*Result) Identifier

func (r *Result) Identifier() string

Identifier returns an empty identifier.

func (*Result) Type

func (r *Result) Type() types.TypeMeta

Type returns an empty TypeMeta.

type Token

type Token string

Token represents a pagination token.

Jump to

Keyboard shortcuts

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