pg-then

1.2.1 • 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

Package Sidebar

Install

npm i pg-then

Weekly Downloads

20

Version

1.2.1

License

MIT

Last publish

Collaborators

  • coderhaoxin
  • jongleberry