1.0.0-dev.3 • Published 3 years ago

@socfony/prisma v1.0.0-dev.3

Weekly downloads
19
License
BSD-3-Clause
Repository
github
Last release
3 years ago

@socfony/prisma

Prisma ORM binding for NestJS.

Installation

npm i @socfony/prisma

If you are using Yarn:

yarn add @socfony/prisma

Usage

import { PrismaModule } from '@socfony/prisma';

@Module({
    imports: [PrismaModule.forRoot()],
})
export class AppModule {}

Options

  • client: If you customize the Prisma output, you can customize the import PrismaClient class, which is imported from @prisma/client by default.
  • {...options}, see PrismaClient options

    Custom PrismaClient

    import { PrismaClient } from './prisma-client';
    
    @Module({
        imports: [PrismaModule.forRoot({
            client: PrismaClient,
            /// More Prisma client options
        })],
    })
    export class AppModule {}

    PrismaClient options in forRoot/forAsyncRoot

    import { PrismaModule } from '@socfony/prisma';
    
    @Module({
        imports: [
            PrismaModule.forRoot({
                // client: PrismaClient, // If you custom Prisma ouput, you can customize the import PrismaClient class, which is imported from `@prisma/client` by default.`
                log: ['info', 'error'],
                // Other Prisma client options
            }),
        ],
    })
    export class AppModule {}

    Async

    import { PrismaModule } from '@socfony/prisma';
    
    @Module({
        imports: [PrismaModule.forRootAsync({
            useFactory: async () => {
                // Custom code.
                return {/* ...Options */}
            },
        })],
    })
    export class AppModule {}

License

BSD 3-Clause License.

Copyright (c) 2021, Odroe Inc. All rights reserved.