1.0.15 • Published 2 years ago

prisma-extension-streams v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago