@@ -7,15 +7,21 @@ export declare enum FieldType {
7
7
JSON = 0 ,
8
8
ARRAY = 1 ,
9
9
TIME = 2 ,
10
- TSVECTOR = 3
10
+ TSVECTOR = 3 ,
11
11
}
12
12
export declare type PostProcessResultFunc = ( res : any [ ] , fields : ResultFieldType [ ] , logger : PgDbLogger ) => void ;
13
+ export interface Notification {
14
+ processId : number ;
15
+ channel : string ;
16
+ payload ?: string ;
17
+ }
13
18
export declare class PgDb extends QueryAble {
14
19
protected static instances : {
15
20
[ index : string ] : Promise < PgDb > ;
16
21
} ;
17
22
pool : any ;
18
23
connection : any ;
24
+ protected connectionForListen : any ;
19
25
config : ConnectionOptions ;
20
26
defaultSchemas : any ;
21
27
db : any ;
@@ -26,7 +32,7 @@ export declare class PgDb extends QueryAble {
26
32
[ name : string ] : PgTable < any > ;
27
33
} ;
28
34
fn : {
29
- [ name : string ] : ( ...any : any [ ] ) => any ;
35
+ [ name : string ] : ( ...any ) => any ;
30
36
} ;
31
37
[ name : string ] : any | PgSchema ;
32
38
pgdbTypeParsers : { } ;
@@ -36,19 +42,23 @@ export declare class PgDb extends QueryAble {
36
42
static getInstance ( config : ConnectionOptions ) : Promise < PgDb > ;
37
43
close ( ) : Promise < void > ;
38
44
static connect ( config : ConnectionOptions ) : Promise < PgDb > ;
39
- private init ;
45
+ private init ( ) ;
40
46
reload ( ) : Promise < void > ;
41
- private initSchemasAndTables ;
42
- private setDefaultTablesAndFunctions ;
43
- private initFieldTypes ;
44
- setTypeParser ( typeName : string , parser : ( string : any ) => any , schemaName ?: string ) : Promise < void > ;
45
- setPgDbTypeParser ( typeName : string , parser : ( string : any ) => any , schemaName ?: string ) : Promise < void > ;
47
+ private initSchemasAndTables ( ) ;
48
+ private setDefaultTablesAndFunctions ( ) ;
49
+ private initFieldTypes ( ) ;
50
+ setTypeParser ( typeName : string , parser : ( string ) => any, schemaName ?: string ) : Promise < void > ;
51
+ setPgDbTypeParser ( typeName : string , parser : ( string ) => any, schemaName ?: string ) : Promise < void > ;
46
52
dedicatedConnectionBegin ( ) : Promise < PgDb > ;
47
53
dedicatedConnectionEnd ( ) : Promise < PgDb > ;
48
54
transactionBegin ( ) : Promise < PgDb > ;
49
55
transactionCommit ( ) : Promise < PgDb > ;
50
56
transactionRollback ( ) : Promise < PgDb > ;
51
57
isTransactionActive ( ) : boolean ;
52
- execute ( fileName : any , statementTransformerFunction ?: ( string : any ) => string ) : Promise < void > ;
58
+ execute ( fileName : any , statementTransformerFunction ?: ( string ) => string) : Promise < void > ;
59
+ private listeners ;
60
+ listen ( channel : string , callback : ( notification : Notification ) => void ) : Promise < void > ;
61
+ unlisten ( channel : string , callback ?: ( Notification ) => void ) : Promise < void > ;
62
+ notify ( channel : string , payload ?: string ) : Promise < any > ;
53
63
}
54
64
export default PgDb ;
0 commit comments