prisma-offset-paginate
v0.0.3
Published
Prisma offset paginate function.
Downloads
1
Maintainers
Readme
Prisma Offset Paginate
Helper function for Prisma offset paginate with Typescript support.
Installation
npm i prisma-offset-paginate
Usage
import paginate from 'prisma-offset-paginate'
// Auto detects type base on model you send to it.
// So args and result will be typed and autocompleted.
const result = await paginate(
prisma.user,
{
where: {
name: {
contains: 'Alice'
}
}
orderBy: {
id: 'desc',
}
},
{ page: 1 }
);
/* Result structure:
{
data: User[]
meta: {
pagination: {
page: number
pageSize: number
pageCount: number
total: number
},
},
}
*/
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.