@@ -14,30 +14,30 @@ const poolFactory = (Client) => {
14
14
}
15
15
}
16
16
17
- var PG = function ( clientConstructor ) {
18
- this . defaults = defaults
19
- this . Client = clientConstructor
20
- this . Query = this . Client . Query
21
- this . Pool = poolFactory ( this . Client )
22
- this . _pools = [ ]
23
- this . Connection = Connection
24
- this . types = require ( 'pg-types' )
25
- this . DatabaseError = DatabaseError
17
+ var PG = function ( exports , clientConstructor ) {
18
+ exports . defaults = defaults
19
+ exports . Client = clientConstructor
20
+ exports . Query = exports . Client . Query
21
+ exports . Pool = poolFactory ( exports . Client )
22
+ exports . _pools = [ ]
23
+ exports . Connection = Connection
24
+ exports . types = require ( 'pg-types' )
25
+ exports . DatabaseError = DatabaseError
26
26
}
27
27
28
28
if ( typeof process . env . NODE_PG_FORCE_NATIVE !== 'undefined' ) {
29
- module . exports = new PG ( require ( './native' ) )
29
+ PG ( module . exports , require ( './native' ) )
30
30
} else {
31
- module . exports = new PG ( Client )
31
+ PG ( module . exports , Client )
32
32
33
33
// lazy require native module...the native module may not have installed
34
34
Object . defineProperty ( module . exports , 'native' , {
35
35
configurable : true ,
36
36
enumerable : false ,
37
37
get ( ) {
38
- var native = null
38
+ var native = { }
39
39
try {
40
- native = new PG ( require ( './native' ) )
40
+ PG ( native , require ( './native' ) )
41
41
} catch ( err ) {
42
42
if ( err . code !== 'MODULE_NOT_FOUND' ) {
43
43
throw err
0 commit comments