MCPcopy Index your code
hub / github.com/charlie-hadden/kysely-paginate

github.com/charlie-hadden/kysely-paginate @v0.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.1 ↗ · + Follow
13 symbols 46 edges 11 files 0 documented · 0% updated 2y agov0.3.1 · 2023-11-23★ 757 open issues

Browse by type

Functions 10 Types & classes 3
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

kysely-paginate

Pagination helpers for use with Kysely.

:warning: This is a work in progress! This library is still very early in development. Things won't work, things will be missing, and there will be breaking changes.

Cursor pagination

const query = db
  .selectFrom("blogPosts")
  .select(["id", "title", "body", "authorId"])
  .where("authorId", "=", 1);

const result = await executeWithCursorPagination(query, {
  perPage: 10,
  fields: [
    { expression: "title", direction: "desc" },
    { expression: "id", direction: "asc" },
  ],
  parseCursor: (cursor) => ({
    title: cursor.title,
    id: parseInt(cursor.id, 10),
  }),
});

Offset pagination

const query = db
  .selectFrom("blogPosts")
  .select(["id", "title", "body", "authorId"])
  .where("authorId", "=", 1)
  .orderBy("title", "desc")
  .orderBy("id", "asc");

const result = await executeWithOffsetPagination(query, {
  perPage: 10,
  page: 1,
})

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 10
Interface 3

Languages

TypeScript100%

Modules by API surface

test/db.ts6 symbols
src/cursor.ts5 symbols
src/offset.ts1 symbols
bench/shared.ts1 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add kysely-paginate \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page