@@ -13,7 +13,6 @@ var defaults = require('./defaults');
1313var Connection = require ( './connection' ) ;
1414var ConnectionParameters = require ( './connection-parameters' ) ;
1515var poolFactory = require ( './pool-factory' ) ;
16- var deprecate = require ( 'deprecate' ) ;
1716
1817var PG = function ( clientConstructor ) {
1918 EventEmitter . call ( this ) ;
@@ -28,8 +27,7 @@ var PG = function(clientConstructor) {
2827
2928util . inherits ( PG , EventEmitter ) ;
3029
31- PG . prototype . end = function ( ) {
32- deprecate ( 'pg.end() is deprecated - please construct pools directly via new pg.Pool()' ) ;
30+ PG . prototype . end = util . deprecate ( function ( ) {
3331 var self = this ;
3432 var keys = Object . keys ( this . _pools ) ;
3533 var count = keys . length ;
@@ -49,10 +47,10 @@ PG.prototype.end = function() {
4947 } ) ;
5048 } ) ;
5149 }
52- } ;
50+ } ,
51+ 'pg.end() is deprecated - please construct pools directly via new pg.Pool()' ) ;
5352
54- PG . prototype . connect = function ( config , callback ) {
55- deprecate ( 'pg.connect() is deprecated - please construct pools directly via new pg.Pool()' ) ;
53+ PG . prototype . connect = util . deprecate ( function ( config , callback ) {
5654 if ( typeof config == "function" ) {
5755 callback = config ;
5856 config = null ;
@@ -78,11 +76,11 @@ PG.prototype.connect = function(config, callback) {
7876 } . bind ( this ) ) ;
7977 }
8078 return pool . connect ( callback ) ;
81- } ;
79+ } ,
80+ 'pg.connect() is deprecated - please construct pools directly via new pg.Pool()' ) ;
8281
8382// cancel the query running on the given client
84- PG . prototype . cancel = function ( config , client , query ) {
85- deprecate ( 'pg.cancel() is deprecated - please create your own client instances to cancel queries' ) ;
83+ PG . prototype . cancel = util . deprecate ( function ( config , client , query ) {
8684 if ( client . native ) {
8785 return client . cancel ( query ) ;
8886 }
@@ -93,7 +91,7 @@ PG.prototype.cancel = function(config, client, query) {
9391 }
9492 var cancellingClient = new this . Client ( c ) ;
9593 cancellingClient . cancel ( client , query ) ;
96- } ;
94+ } , 'pg.cancel() is deprecated - please create your own client instances to cancel queries' ) ;
9795
9896if ( typeof process . env . NODE_PG_FORCE_NATIVE != 'undefined' ) {
9997 module . exports = new PG ( require ( './native' ) ) ;
0 commit comments