diff --git a/lib/index.js b/lib/index.js index 0cad644d7..3d7aa5807 100644 --- a/lib/index.js +++ b/lib/index.js @@ -12,6 +12,7 @@ var PG = function(clientConstructor) { this.Query = this.Client.Query; this.pools = pool; this.Connection = Connection; + this.types = require('pg-types'); }; util.inherits(PG, EventEmitter); diff --git a/test/unit/utils-tests.js b/test/unit/utils-tests.js index 660afbfbc..56c81dc52 100644 --- a/test/unit/utils-tests.js +++ b/test/unit/utils-tests.js @@ -2,6 +2,14 @@ require(__dirname + '/test-helper'); var utils = require(__dirname + "/../../lib/utils"); var defaults = require(__dirname + "/../../lib").defaults; + +test('ensure types is exported on root object', function() { + var pg = require('../../lib') + assert(pg.types) + assert(pg.types.getTypeParser) + assert(pg.types.setTypeParser) +}) + //this tests the monkey patching //to ensure comptability with older //versions of node