Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dandi/data-pg

dandi-mvc32MITdeprecated1.0.0-alpha.29TypeScript support: included

this package has been moved to @dandi-contrib/data-pg

@dandi/data-pg wraps the node-postgres client in implementations of @dandi/data's interfaces.

readme

@dandi/data-pg

@dandi/data-pg wraps the node-postgres client in implementations of @dandi/data's interfaces.

See @dandi/data for basic usage and configuration.

Using @dandi/data-pg In Your App

In addition to setting up the connection and authentication data described in @dandi/data, include PgDbModule in your Container providers:

import { Container } from '@dandi/core';
import { PgDbModule } from '@dandi/data-pg';

const myApp = new Container({
  providers: [

    ...

    // database
    PgDbModule,

    ...

  ],
});

Configuring ModelBuilder

Include a Provider<ModelBuilderOptions> for PgDbModelBuilderOptions in your Container providers:

import { Container } from '@dandi/core';
import { PgDbModelBuilderOptions, PgDbModule } from '@dandi/data-pg';
import { ModelBuilderOptions } from '@dandi/model-builder';

import { camel } from 'change-case';

const myApp = new Container({
  providers: [

    ...

    ModelBuilderOptions.provider(PgDbModelBuilderOptions, {
      keyTransform: camel,
    })

    ...

  ],
});