Skip to content

PaginateOptions

PaginateOptions = object

Defined in: packages/db/src/types.ts:333

Options for db.query(table).paginate().

Combines query filtering with pagination-specific settings. The actual pagination strategy (cursor vs. offset) is determined by the PaginateParams passed alongside these options.

db.query(posts).paginate(params, {
where: eq(posts.published, true),
orderBy: desc(posts.createdAt),
cursorColumns: [posts.createdAt, posts.id],
orderDirection: "desc",
});

optional cache: QueryCacheOptions

Defined in: packages/db/src/types.ts:351

Per-query cache control. Pass false to skip caching, or an object to customize.


optional columns: Record<string, boolean>

Defined in: packages/db/src/types.ts:335

Column selection (e.g., { id: true, title: true }). Omit to select all columns.


optional cursorColumns: unknown[]

Defined in: packages/db/src/types.ts:341

Drizzle column references used for cursor-based ordering and comparison.


optional orderBy: unknown

Defined in: packages/db/src/types.ts:339

Ordering expression for offset pagination. Ignored for cursor pagination (uses cursorColumns instead).


optional orderDirection: "asc" | "desc"

Defined in: packages/db/src/types.ts:343

Sort direction for cursor pagination. Defaults to "desc".


optional where: unknown

Defined in: packages/db/src/types.ts:337

User-supplied filter condition (AND’d with permission filters at .run() time).


optional with: Record<string, unknown>

Defined in: packages/db/src/types.ts:349

Drizzle relational query includes (e.g., { comments: true }).

Note: Permission filters are only applied to the root table, not to joined relations.