listcursor

package
v0.3.0-beta.32 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package listcursor provides versioned, query-bound opaque cursors for stable list pagination.

Index

Constants

View Source
const (
	// DefaultMaxEncodedSize bounds cursors accepted from public inputs.
	DefaultMaxEncodedSize = 4096
)

Variables

View Source
var (
	// ErrInvalid reports malformed cursors and cursors reused with a different query contract.
	ErrInvalid = errors.New("list cursor is invalid")
)

Functions

func Decode

func Decode[T any](
	raw string,
	version int,
	kind string,
	fingerprint string,
	maxEncodedSize int,
) (T, error)

Decode parses a typed cursor and verifies its version, kind, and query fingerprint.

func Encode

func Encode[T any](version int, kind string, fingerprint string, position T) (string, error)

Encode serializes a typed cursor position with its version, kind, and query fingerprint.

func Fingerprint

func Fingerprint(value any) (string, error)

Fingerprint returns a deterministic SHA-256 digest for normalized query state.

Types

This section is empty.

Jump to

Keyboard shortcuts

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