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

paging

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package paging holds what every cursor-paged store list shares.

Dispatch IDs are UUIDv7 TypeIDs minted with a monotonic counter, so a row's ID sorts by when it was created. Every paged list orders by ID, newest first, and its cursor is the ID of the last row a page returned: the next page is every matching row whose ID sorts strictly below it. A cursor is therefore stable across inserts and deletes, and a deleted cursor row still marks its place.

Index

Constants

View Source
const DefaultLimit = 50

DefaultLimit is the page size when a caller passes zero or less.

Variables

View Source
var ErrInvalidCursor = errors.New("dispatch: invalid page cursor")

ErrInvalidCursor is returned when a cursor is not an ID of the kind the list pages by. Stores never fall back to the first page on a bad cursor: a client that sent one would otherwise see page one again and believe it had reached the end.

Functions

func Cursor

func Cursor(raw string, prefix id.Prefix) (id.ID, error)

Cursor validates raw as an ID with the given prefix. An empty raw is the first page and returns the nil ID.

func Limit

func Limit(n int) int

Limit returns n, or DefaultLimit when n is zero or negative.

Types

This section is empty.

Jump to

Keyboard shortcuts

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