prisma-pagination-extension
v1.0.1
Published
Prisma Client extension for pagination.
Downloads
11
Maintainers
Readme
Prisma Pagination Extension
Introduction
Prisma Client extension for pagination.
Installation
npm i prisma-pagination-extension
Usage
import { PrismaClient } from "@prisma/client";
import paginationExtension from 'prisma-pagination-extension';
const prisma = new PrismaClient();
const xprisma = prisma.$extends(paginationExtension);
const [users, meta] = await xprisma.user.paginate({
select: {
firstName: true,
lastName: true,
email: true,
},
pagination: {
page: 1,
pageSize: 10,
},
});
/* meta structure:
{
page: number
pageSize: number
pageCount: number
total: number
}
*/