Skip to content

KeysetSpec

type KeysetSpec = object;

Defined in: keyset.ts:63

Portable keyset pagination description.

The spec does not know about SQL, Drizzle, Prisma, Kysely, or Knex. It only describes ordering and lexicographic seek predicates in a small AST that adapters can render to their own query APIs.

readonly sort: KeysetSortKey[];

Defined in: keyset.ts:65

Normalized sort keys (defaults applied).

keys(): string[];

Defined in: keyset.ts:67

Column keys in sort order — handy for cursor.fromItem validation.

string[]


orderBy(direction?): KeysetSortKey[];

Defined in: keyset.ts:72

Sort keys for a fetch direction. Backward flips each column’s order so fetchers can ORDER BY ... DESC while the paginator restores natural order.

Parameter Type
direction? CursorDirection

KeysetSortKey[]


where(cursor, direction?):
| KeysetWhere
| null;

Defined in: keyset.ts:77

Lexicographic keyset WHERE for the given cursor position. null cursor ⇒ null (first page). Matches drizzle-cursor’s where().

Parameter Type
cursor Record<string, unknown> | null | undefined
direction? CursorDirection

| KeysetWhere | null