@socfony/prisma
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-dev.3 • Public • Published

@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.

Readme

Keywords

none

Package Sidebar

Install

npm i @socfony/prisma

Weekly Downloads

0

Version

1.0.0-dev.3

License

BSD-3-Clause

Unpacked Size

9.16 kB

Total Files

8

Last publish

Collaborators

  • medz