1.0.15 • Published 11 months ago

prisma-extension-streams v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

NPM Module for Streams in Prisma ORM

Prisma Streams is a typescript first module that will transform SQL data from queries in streams, in order to improve performance in larger datasets. This module will be configured as a Prisma ORM client extension that will return Node Streams from Prisma queries.

It's recomendable to take a look on Prisma install and configuration before using this module.

Quick start

To use extension:

  1. Create your prisma client in project (if doesnt exists) using:
    npx prisma generate
  2. Install Prisma Streams.
    npm install prisma-extension-streams
  3. Import Prisma Streams module inside your project
    import { PrismaStreams } from 'prisma-extension-streams';
    //OR
    import * as PrismaStreams from 'prisma-extension-streams';
  4. Set $extends configuration and create a new Prisma Client, example:

    import { PrismaStreams } from 'prisma-extension-streams';
    
    const prismaClient = new PrismaClient()
    const xprisma = prismaClient.$extends(PrismaStreams)
    //OR
    const prismaClient = new PrismaClient().$extends(PrismaStreams)
  5. Usage example:

    import { PrismaStreams } from 'prisma-extension-streams';
    
    const prismaClient = new PrismaClient().$extends(PrismaStreams)
    
    async findAll() {
    //TS Ignore is necessary because this is a beta feature on Prisma and type-safety is being improved.
    //@ts-ignore
    const stream = prismaClient.product.findManyStream()
    for await (const entity of stream) {
      console.log(entity.id)
    }
    }

GitHub

If you liked this project, dont hesitate to star that project on our GitHub. Happy Code c:

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago