11// Code generated by queryx, DO NOT EDIT.
22
3- import { Pool , QueryResultRow , types } from "pg" ;
3+ import pg from "pg" ;
44import { parse } from "date-fns" ;
55import { Config } from "./config" ;
66
7- types . setTypeParser ( types . builtins . INT8 , ( val ) => parseInt ( val , 10 ) ) ;
7+ pg . types . setTypeParser ( pg . types . builtins . INT8 , ( val ) => parseInt ( val , 10 ) ) ;
88
99export class Adapter {
1010 public config : Config ;
11- public pool : Pool ;
12- public db : Pool ;
11+ public pool ?: pg . Pool ;
12+ public db ?: pg . Pool ;
1313
1414 constructor ( config : Config ) {
1515 this . config = config ;
1616 }
1717
1818 connect ( ) {
19- const pool = new Pool ( {
19+ const pool = new pg . Pool ( {
2020 connectionString : this . config . url ,
2121 } ) ;
2222 this . pool = pool ;
@@ -31,20 +31,23 @@ export class Adapter {
3131 this . db . release ( ) ;
3232 }
3333
34- private _query < R extends QueryResultRow = any , I extends any [ ] = any [ ] > (
34+ private _query < R extends pg . QueryResultRow = any , I extends any [ ] = any [ ] > (
3535 query : string ,
3636 args ?: I ,
3737 ) {
3838 let [ query1 , args1 ] = rebind < I > ( query , args ) ;
3939 return this . db . query < R , I > ( query1 , args1 ) ;
4040 }
4141
42- async query < R extends QueryResultRow = any > ( query : string , ...args : any [ ] ) {
42+ async query < R extends pg . QueryResultRow = any > (
43+ query : string ,
44+ ...args : any [ ]
45+ ) {
4346 const res = await this . _query < R > ( query , args ) ;
4447 return res . rows ;
4548 }
4649
47- async queryOne < R extends QueryResultRow = any > (
50+ async queryOne < R extends pg . QueryResultRow = any > (
4851 query : string ,
4952 ...args : any [ ]
5053 ) {
0 commit comments