@motiz88/pg-then
v2.0.0
Published
pg-then: use pg by promise
Downloads
8
Maintainers
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