Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paginate-prisma

Package Overview
Dependencies
Maintainers
0
Versions
315
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paginate-prisma

[![Maintainability](https://api.codeclimate.com/v1/badges/6b08ca1cc22333d5e1be/maintainability)](https://codeclimate.com/github/qlaffont/paginate-prisma/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6b08ca1cc22333d5e1be/test_cov

  • 1.0.312
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Maintainability Test Coverage npm npm Snyk Vulnerabilities for npm package NPM

Paginate Prisma

A TS plugin wrapping pagination for Prisma ORM. Old Owner: @flexper

Install

pnpm i paginate-prisma

Use

import { paginate, PAGINATION_ORDER } from 'paginate-prisma';

const prisma = new PrismaClient();
await paginate(prisma.user)(
  {},
  {
    sort: {
      field: 'tokens._count',
      order: PAGINATION_ORDER.ASC,
    },
  }
);

For type-graphql integration, check example/type.ts

API

paginate(prismaModel)(query, sortingOptions, additionalFindMany)

Options

Field NameTypeDescription
prismaModelPrisma ModelPrisma model/table/entity to use
sortingOptionsPaginationOptionsOptions to use for pagination (Page, sorting, etc)
additionalFindManyPrisma FindManyArgumentOther params in findMany as include, cursor, etc

Return Promise<PaginationResult & {data: T[]}>

Field NameTypeDescription
dataT[]Paginated Data
pagenumberCurrent page
pagesnumberTotal number of pages
limitnumberNumber of row to be returned
itemsnumberTotal number of items

Test

To test this package, you need to run a PostgresSQL server :


docker-compose up -d
chmod -R 777 docker
pnpm prisma migrate deploy
pnpm test

Maintain

This package use TSdx. Please check documentation to update this package.

FAQs

Package last updated on 20 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc