toDrizzleRqbV1Keyset
function toDrizzleRqbV1Keyset(columns): DrizzleRqbV1Keyset;Defined in: pagination-drizzle-rqb.ts:170
RQB v1 keyset adapter — renders the keyset AST to drizzle v1’s legacy
where/orderBy CALLBACKS ((fields, operators) => …), building via the
provided operators/fields (no raw-SQL alias footgun). Driver-free. columns
maps logical cursor keys to the table’s field keys, as in toDrizzleRqbKeyset.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
columns |
Record<string, string> |
Returns
Section titled “Returns”Example
Section titled “Example”import { createKeysetSpec } from "@xtandard/lib/pagination";import { toDrizzleRqbV1Keyset } from "@xtandard/lib/pagination/drizzle-rqb";
const keyset = createKeysetSpec({ sort: [{ key: "createdAt", order: "desc" }, { key: "id", order: "asc" }],});const rqb = toDrizzleRqbV1Keyset({ createdAt: "createdAt", id: "id" });
// drizzle calls each callback with (fields, operators); for a cursor it builds// createdAt < x OR (createdAt = x AND id > y)const rows = await db.query.posts.findMany({ where: rqb.where(keyset.where(cursor, direction)), // undefined on the first page orderBy: rqb.orderBy(keyset.orderBy(direction)), // [desc(createdAt), asc(id)] forward limit,});