cursorbased

package
v0.0.0-...-3c68a0f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLimit int = 20
	MaxLimit     int = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	// Cursor is unique identifier (ULID) of the last item from the previous page.
	// If empty, it includes the first page
	Cursor types.ID `json:"cursor"`
	// Limit specifies how many items to fetch.
	Limit int `json:"limit"`
}

Request represents the structure for cursor-based pagination requests.

func (*Request) BasicValidation

func (r *Request) BasicValidation() error

BasicValidation ensures the request parameters are within valid ranges.

type Response

type Response struct {
	// Next Counter is the ID of the last item in the current list.
	// The client should user this as the `cursor` for the next request.
	NextCursor types.ID `json:"next_cursor"`
	// HasMore indicates if there are mote item available to fetch.
	HasMore bool `json:"has_more"`
}

Response represents the structure for cursor-based pagination responses.

Jump to

Keyboard shortcuts

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