paging

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package paging holds the cursor-pagination helpers shared by every domain that walks a Control Tower list RPC. It lives outside internal/cmd because sibling command packages must not import each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPaginationRequest

func NewPaginationRequest(pageSize uint32, pageToken string) *messagescontroltowerv1.PaginationRequest

NewPaginationRequest builds a PaginationRequest, leaving zero values unset so the server applies its defaults.

func Paginate

func Paginate(
	ctx context.Context,
	label string,
	fetch func(ctx context.Context, pageToken string) (string, error),
) error

Paginate walks a cursor-paginated list RPC until the server stops handing out a next page token. fetch receives the current page token and returns the next one. Returning an empty token from fetch also stops the walk, which lets a caller finish early once it has everything it needs. The repeated-token guard keeps a server that cycles tokens from looping forever.

Types

This section is empty.

Jump to

Keyboard shortcuts

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