diff --git a/lib/client.js b/lib/client.js index c861daf..eb04e6b 100644 --- a/lib/client.js +++ b/lib/client.js @@ -218,4 +218,7 @@ Client.md5 = function(string) { return crypto.createHash('md5').update(string).digest('hex'); }; +// expose a Query constructor +Client.Query = Query; + module.exports = Client; diff --git a/lib/index.js b/lib/index.js index da27c49..9dcf7c1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -13,7 +13,7 @@ var PG = function(clientConstructor) { EventEmitter.call(this); this.Client = clientConstructor; this.Connection = require(__dirname + '/connection'); - this.Query = require(__dirname + '/query'); + this.Query = clientConstructor.Query this.defaults = defaults; }; diff --git a/lib/native/index.js b/lib/native/index.js index ae7fd0a..8fc5adf 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -171,4 +171,7 @@ var clientBuilder = function(config) { return connection; }; +// expose a Query constructor +clientBuilder.Query = NativeQuery; + module.exports = clientBuilder;