pagination

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDExtractor

type IDExtractor func(element interface{}) interface{}

IDExtractor extracts an ID from an untyped parameter. It's expected that IDExtractors will downcast element to the expected type and panic if the downcast fails.

type Pageable

type Pageable interface {
	// ExtractID derives an identifier that is guaranteed to be unique relative
	// to any elements with which it may coexist in a given collection
	ExtractID() string
}

Pageable is an type that can be paginated when present in a collection.

func GetPageAfterID

func GetPageAfterID(
	elements []Pageable,
	after string,
	pageSize uint,
) []Pageable

GetPageAfterID paginates elements. The first element of the returned page directly follows the element in elements having an ID equivalent to after. At most pageSize results are included in the returned page.

Jump to

Keyboard shortcuts

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