interface CursorPayload
Since 0.2.0

The decoded contents of a cursor minted by encodeCursor: the values of every ordered field (in orderBy order) plus the primary-key column values (for tiebreaker lookups) plus a stable fingerprint of the sort specification. The fingerprint is what a fingerprint mismatch on decode detects.

The i-th element of orderedValues is the value of Object.entries(orderBy)[i] from the row the cursor was minted against. This is what keysetPredicate indexes to build the "row after this one" comparison — a cursor that carried only key-column values would be wrong whenever orderBy contains non-key fields.

keyValues carries the same information but indexed by key column name rather than by orderBy position. It is used by keysetPredicate as the tiebreaker fallback when a key column is absent from orderBy — using orderedValues[0] there would be wrong because the first ordered-value may belong to a non-key field.

Properties

readonly
orderedValues: ReadonlyArray<CursorValue>

The value of every ordered field (in orderBy declaration order), from the row the cursor was minted against. Index i is the value of the i-th entry of Object.entries(orderBy).

readonly
keyValues: ReadonlyArray<CursorValue>

The primary-key column values (in key-column order), from the row the cursor was minted against. Used by keysetPredicate as the tiebreaker fallback when a key column is absent from orderBy.

readonly
sortFingerprint: string

A stable fingerprint of the resolved sort specification: each ordered field paired with its direction, in order. A cursor minted under one sort and presented under another has a different fingerprint, so the caller is refused by name rather than served a silently wrong page.

Usage

import { type CursorPayload } from "database-plugin/src/index.ts";