Skip to main content

@rtorcato/db-common / cursorPaginate

Function: cursorPaginate()

cursorPaginate(__namedParameters): CursorQuery

Defined in: cursor.ts:66

Build a driver-agnostic keyset (cursor) page: a limit, a where predicate past the previous cursor, and an order. To detect a next page, fetch limit + 1 rows, trim the extra, and encodeCursor the last kept row's column value as the next after.

cursorPaginate({ size: 20, column: 'id', after }) // → { limit: 20, where: [{ col:'id', op:'gt', val: }], order:[…] }

ponytail: single-column keyset — ties on a non-unique column can skip/repeat rows. Upgrade to a composite (sortCol, id) cursor if you paginate on a non-unique column.

Parameters

__namedParameters

CursorInput

Returns

CursorQuery