OffsetPage
OffsetPage<
T> =object
Defined in: packages/db/src/types.ts:305
A page of results from offset-based pagination.
Includes total counts for rendering page navigation controls.
Example
Section titled “Example”const page: OffsetPage<Post> = await db.query(posts) .paginate({ type: "offset", page: 1, limit: 20 }) .run({});
console.log(`Page ${page.page} of ${page.totalPages} (${page.total} total)`);Type Parameters
Section titled “Type Parameters”T
The row type.
Properties
Section titled “Properties”items:
T[]
Defined in: packages/db/src/types.ts:307
The items on this page.
page:
number
Defined in: packages/db/src/types.ts:311
The current 1-based page number.
total:
number
Defined in: packages/db/src/types.ts:309
Total number of matching rows across all pages.
totalPages
Section titled “totalPages”totalPages:
number
Defined in: packages/db/src/types.ts:313
Total number of pages (computed as Math.ceil(total / limit)).