@motiz88/pg-then

2.0.0 • Public • Published

NPM version Build status Test coverage License Dependency status

pg-then

  • Use postgresql with promise api, based on pg.

Install

$ npm install pg
$ npm install pg-then

Usage

const pg = require('pg-then')

const pool = pg.Pool('postgres://username:password@localhost/database')

pool
  .query('SELECT ...')
  .then(...)
  .catch(...)
pg.Pool(config)
  .stream('SELECT ...')
  .on('data', data => ...)
  .on('end', () => ...)
  .on('error', err => ...)
const pg = require('pg-then')

const client = pg.Client('postgres://username:password@localhost/database')

client
  .query('SELECT ...')
  .then(...)
  .catch(...)

// ...

client.end()

License

MIT

Dependencies (2)

Dev Dependencies (4)

Package Sidebar

Install

npm i @motiz88/pg-then

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • motiz88