pg-then
v1.2.1
Published
pg-then: use pg by promise
Downloads
292
Readme
pg-then
- Use
postgresql
withpromise
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