paging

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package paging defines cursor-page requests, generic results and shared page-size bounds.

Design

Page and Result are transport-neutral values used by multiple storage and service contracts. Size applies the default and maximum before allocation or querying, keeping limits consistent across backends. The package does not define ordering, query filters or cursor encoding; each issuing backend owns those semantics. Callers should treat cursors as opaque.

References

Index

Constants

View Source
const DefaultPageSize = 100

DefaultPageSize applies when Page.Limit is not positive.

View Source
const MaxPageSize = 1000

MaxPageSize bounds Page.Limit. A limit reaches a slice allocation before a single row is read, so an unbounded one turns one request into an out-of-memory kill of the process.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	Cursor string
	Limit  int
}

Page requests one page of results. An empty Cursor starts from the beginning; Limit <= 0 uses the backend default.

func (Page) Size

func (p Page) Size() int

Size returns the page size to use: the requested limit, defaulted and bounded, so every backend agrees without repeating the rule.

type Result

type Result[T any] struct {
	Items      []T
	NextCursor string
}

Result is one page of items with the cursor for the next page ("" at the end).

Jump to

Keyboard shortcuts

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