8.2.0 • Published 3 years ago

@gasbuddy/configured-postgres-client v8.2.0

Weekly downloads
88
License
UNLICENSED
Repository
github
Last release
3 years ago

configured-postgres-client

A small wrapper around pg/pg-promise to allow configuration from confit and tracking of start/finish/error on all queries.

Supports the following methods from pg-promise: connect, any, none, one, oneOrNone, many, manyOrNone, result, tx, task

SQL Files

This module also supports Query files from PGPromise. In your config, pass in the directory of your query files. You will then get an object that has the same structure as the folders you defined.

If your folder structure looks like this:

 - feature
    - create.sql
    - getById.sql

You could make a DB call like this:

async getById(featureId, locale) {
    let returnFeature = null;
    const sqlFiles = this.dbClient.sqlFiles;
    const dbFeature = await this.dbClient.oneOrNone(sqlFiles.feature.getById, [featureId, locale]);
    if (dbFeature) {
      returnFeature = dbFeature.metadata;
    }
   return returnFeature;
 }
8.2.0

3 years ago

8.0.0

5 years ago

7.2.0

6 years ago

7.1.0

7 years ago

7.0.0

7 years ago

6.0.0

7 years ago

5.1.0

7 years ago

5.0.0

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.1.5

8 years ago

2.1.4

8 years ago

2.1.3

8 years ago

2.1.2

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

9 years ago