function mintNextCursor
Since 0.2.0
mintNextCursor(
pageRows: readonly Record<string, unknown>[],
orderBy: Readonly<Record<string, OrderDirection>>,
keyColumns: readonly string[],
fingerprint: string,
hasMore: boolean
): string | null

Mint the next-page cursor from the last row of a non-terminal page.

The cursor is only ever produced when hasMore is true AND the page is non-empty: on a terminal page there is no next row to continue to, and reading the ordered/key values off an empty page would crash on the missing last row.

Parameters

pageRows: readonly Record<string, unknown>[]

The rows of the page about to be returned (empty is fine)

orderBy: Readonly<Record<string, OrderDirection>>

The resolved sort specification

keyColumns: readonly string[]

The primary-key columns for cursor minting

fingerprint: string

The sort fingerprint to embed in the cursor

hasMore: boolean

Whether a further page exists

Return Type

string | null

The encoded cursor, or null when the page is terminal

Usage

import { mintNextCursor } from "common/src/index.ts";