Skip to content

CreatePaginatorOptions

type CreatePaginatorOptions<T, TCursor> = object;

Defined in: pagination.ts:120

Possibly-async fetchers with a sync codec — the common case.

Type Parameter
T
TCursor extends Record<string, unknown>
cursor?: PaginatorCursorOptionsSync<T, TCursor>;

Defined in: pagination.ts:135

Required for cursor pagination and for cursors in page/offset results.


fetchCursor?: (window) => MaybePromise<PaginationFetchResult<T>>;

Defined in: pagination.ts:133

Fetch for cursor requests (keyset SQL via drizzle-cursor, Mongo range queries…). Fetch up to window.limit rows after/before window.cursor, flipping sort order when window.direction is "backward".

Parameter Type
window CursorWindow<TCursor>

MaybePromise<PaginationFetchResult<T>>


fetchOffset?: (window) => MaybePromise<PaginationFetchResult<T>>;

Defined in: pagination.ts:126

Fetch for page/offset requests (SQL OFFSET, Mongo .skip(), REST ?offset=…). Fetch up to window.limit rows — it includes a one-row lookahead used to compute hasNextPage, so do not cap it yourself.

Parameter Type
window OffsetWindow

MaybePromise<PaginationFetchResult<T>>


maxLimit?: number;

Defined in: pagination.ts:137

Hard cap applied to any requested limit/pageSize. Default: no cap.