Skip to content

Instantly share code, notes, and snippets.

View axmad386's full-sized avatar
๐Ÿš€
working hard

Akhmad Salafudin axmad386

๐Ÿš€
working hard
View GitHub Profile
@axmad386
axmad386 / drizzle-paginate.md
Created May 17, 2024 14:41
Fully Typed Drizzle ORM Dynamic Pagination Query

Pagination Helper

This is simple helper for dynamic pagination using drizzle-orm using basic limit offset. The result is fully typed.

import { db } from "../yourdbinstance";
import { sql } from "drizzle-orm";
import type { PgSelect } from "drizzle-orm/pg-core";

interface PaginateParam {
  limit: number;
 page: number;