UNPKG

439 BJavaScriptView Raw
1//peerDependency - use whichever version is installed
2//in the project
3var pg = require('pg');
4
5var ok = require('okay');
6
7var query = module.exports = function(text, values, cb) {
8 //normalize params
9 if(typeof values == 'function') {
10 cb = values;
11 values = [];
12 }
13 pg.connect(ok(cb, function(client, done) {
14 client.query(text, values, ok(cb, function(res) {
15 done();
16 cb(null, res.rows, res);
17 }));
18 }));
19};