pagination

package
v0.0.0-...-5010687 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustPageSize

func AdjustPageSize(pageSize int32) int

AdjustPageSize takes the given requested pageSize and adjusts as necessary.

func InvalidToken

func InvalidToken(err error) error

InvalidToken annotates the error with InvalidArgument appstatus.

func ParseToken

func ParseToken(token string) ([]string, error)

ParseToken extracts a string slice position from the given page token. May return an appstatus-annotated error.

func Token

func Token(pos ...string) string

Token converts an string slice representing page token position to an opaque token string.

func ValidatePageSize

func ValidatePageSize(pageSize int32) error

ValidatePageSize returns a non-nil error if pageSize is invalid. Returns nil if pageSize is 0.

Types

type PageSizeLimiter

type PageSizeLimiter struct {
	Max     int32
	Default int32
}

func (*PageSizeLimiter) Adjust

func (psl *PageSizeLimiter) Adjust(pageSize int32) int32

Adjust the requested pageSize according to PageSizeLimiter.Max and PageSizeLimiter.Default as necessary.

Jump to

Keyboard shortcuts

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