pagination

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 8 Imported by: 6

Documentation

Overview

Package pagination provides primitives for implementing AIP pagination.

See: https://google.aip.dev/158 (Pagination).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OffsetPageToken

type OffsetPageToken struct {
	// Offset of the page.
	Offset int64
	// RequestChecksum is the checksum of the request that generated the page token.
	RequestChecksum uint32
}

OffsetPageToken is a page token that uses an offset to delineate which page to fetch.

func ParseOffsetPageToken

func ParseOffsetPageToken(request Request) (_ OffsetPageToken, err error)

ParseOffsetPageToken parses an offset-based page token from the provided Request.

If the request does not have a page token, a page token with offset 0 will be returned.

func (OffsetPageToken) Next

func (p OffsetPageToken) Next(request Request) OffsetPageToken

Next returns the next page token for the provided Request.

func (OffsetPageToken) String

func (p OffsetPageToken) String() string

String returns a string representation of the page token.

type Request

type Request interface {
	proto.Message
	// GetPageToken returns the page token of the request.
	GetPageToken() string
	// GetPageSize returns the page size of the request.
	GetPageSize() int32
}

Request is an interface for paginated request messages.

See: https://google.aip.dev/158 (Pagination).

Jump to

Keyboard shortcuts

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