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()
Extras
- jadbox/pg-rxjs combining PostgreSQL and Rx for Node
License
MIT