Help us shape the future of Go! Take the 2026 Go Developer Survey

pagination

package
v0.87.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectAll

func CollectAll[T any](ctx context.Context, pageFn func(context.Context, uint32, string) ([]T, string, error), pageSize uint32) ([]T, error)

CollectAll invokes pageFn repeatedly to retrieve all pages and returns a combined slice of results. Pagination stops when pageFn returns an empty nextToken. The pageFn callback must have the form:

pageFn(ctx, pageSize, token) → (items, nextToken, error)

func MarshalPageToken

func MarshalPageToken(args ...any) string

MarshalPageToken encodes one or more args into a URL-safe base64 token.

func UnmarshalPageToken

func UnmarshalPageToken(token string, args ...any) error

UnmarshalPageToken decodes a token into the provided pointers in order.

func ValidPageSize

func ValidPageSize(pageSize uint32, defaultPageSize int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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