File tree Expand file tree Collapse file tree 5 files changed +98
-2
lines changed Expand file tree Collapse file tree 5 files changed +98
-2
lines changed Original file line number Diff line number Diff line change 1+ import type * as pg from "./index.d.ts" ;
2+
3+ import TypeOverrides = require( "./lib/type-overrides" ) ;
4+
5+ export type * from "./index.d.ts" ;
6+
7+ export const defaults : typeof pg . defaults ;
8+ export const Client : typeof pg . Client ;
9+ export const Query : typeof pg . Query ;
10+ export const Pool : typeof pg . Pool ;
11+ export const Connection : typeof pg . Connection ;
12+ export const types : typeof pg . types ;
13+ export const DatabaseError : typeof pg . DatabaseError ;
14+ export const escapeIdentifier : typeof pg . escapeIdentifier ;
15+ export const escapeLiteral : typeof pg . escapeLiteral ;
16+ export const Result : typeof pg . Result ;
17+
18+ export { TypeOverrides } ;
19+
20+ declare const PG : {
21+ defaults : typeof pg . defaults ;
22+ Client : typeof pg . Client ;
23+ Query : typeof pg . Query ;
24+ Pool : typeof pg . Pool ;
25+ Connection : typeof pg . Connection ;
26+ types : typeof pg . types ;
27+ DatabaseError : typeof pg . DatabaseError ;
28+ TypeOverrides : typeof TypeOverrides ;
29+ escapeIdentifier : typeof pg . escapeIdentifier ;
30+ escapeLiteral : typeof pg . escapeLiteral ;
31+ Result : typeof pg . Result ;
32+ } ;
33+
34+ export default PG ;
Original file line number Diff line number Diff line change @@ -326,3 +326,13 @@ import * as Pg from ".";
326326export const native : typeof Pg | null ;
327327
328328export { DatabaseError } from "pg-protocol" ;
329+
330+ export class Result < R extends QueryResultRow = any > implements QueryResult < R > {
331+ command : string ;
332+ rowCount : number | null ;
333+ oid : number ;
334+ fields : FieldDef [ ] ;
335+ rows : R [ ] ;
336+
337+ constructor ( rowMode : string , t : typeof types ) ;
338+ }
Original file line number Diff line number Diff line change 11{
22 "private" : true ,
33 "name" : " @types/pg" ,
4- "version" : " 8.12 .9999" ,
4+ "version" : " 8.15 .9999" ,
55 "projects" : [
66 " https://github.com/brianc/node-postgres"
77 ],
8+ "exports" : {
9+ "." : {
10+ "import" : " ./index.d.mts" ,
11+ "require" : " ./index.d.ts"
12+ },
13+ "./lib/*" : " ./lib/*.d.ts"
14+ },
815 "dependencies" : {
916 "@types/node" : " *" ,
1017 "pg-protocol" : " *" ,
Original file line number Diff line number Diff line change 1+ import pg , {
2+ Client ,
3+ Connection ,
4+ DatabaseError ,
5+ defaults ,
6+ escapeIdentifier ,
7+ escapeLiteral ,
8+ Pool ,
9+ Query ,
10+ TypeOverrides ,
11+ types ,
12+ } from "pg" ;
13+
14+ const client = new pg . Client ( {
15+ host : "my.database-server.com" ,
16+ port : 5334 ,
17+ user : "database-user" ,
18+ password : "secretpassword!!" ,
19+ application_name : "DefinitelyTyped" ,
20+ keepAlive : true ,
21+ } ) ;
22+ client . setTypeParser ( 20 , val => Number ( val ) ) ;
23+ client . getTypeParser ( 20 ) ;
24+
25+ const res = new pg . Result ( "array" , pg . types ) ;
26+ res . rows . forEach ( row => row ) ;
27+
28+ const poolSize : number | undefined = defaults . poolSize ;
29+ const poolIdleTimeout : number | undefined = defaults . poolIdleTimeout ;
30+ const reapIntervalMillis : number | undefined = defaults . reapIntervalMillis ;
31+ const binary : boolean | undefined = defaults . binary ;
32+ const parseInt8 : boolean | undefined = defaults . parseInt8 ;
33+ const parseInputDatesAsUTC : boolean | undefined = defaults . parseInputDatesAsUTC ;
34+
35+ const client2 = new Client ( {
36+ host : "my.database-server.com" ,
37+ port : 5334 ,
38+ user : "database-user" ,
39+ password : "secretpassword!!" ,
40+ application_name : "DefinitelyTyped" ,
41+ keepAlive : true ,
42+ } ) ;
43+ client2 . setTypeParser ( 20 , val => Number ( val ) ) ;
44+ client2 . getTypeParser ( 20 ) ;
Original file line number Diff line number Diff line change 1515 },
1616 "files" : [
1717 " index.d.ts" ,
18- " pg-tests.ts"
18+ " pg-tests.ts" ,
19+ " pg-tests.mts"
1920 ]
2021}
You can’t perform that action at this time.
0 commit comments