pg-rxjs
Install
$ npm install pg$ npm install pg-rxjs
Usage
const pg = // Default config: { debug: false, noMoment: false }// 'debug' option console.logs statements that pg will executeconst pool = pg pool
pg // runs for each row streamed from the query
const pg = const client = pgconst query = clientquery; // methods are already bound to the client // Using Rx chaining client
- Transactions (\w auto-rollback) supports only waterfall queuing
var transaction = clienttransaction; // btw, methods do not rely on 'this'var query = clientquery;
- Input time using Moment.js
- Disable by setting opts: pg.Client(url, {noMoment: true})
- Only works with timestamps, not date fields
- Works with transactions and stream methods too
- Moment objects are auto converted to UTC (best practice)
// Use $NOW to insert a timestamp value of the current UTC time// .. the same as query('SELECT to_timestamp(1452819700) AS time_now') // Use a moment object to insert a placeholder as a timestamp// Note: no need to specify the paremeter as a timestampconst m = ;
License
MIT