pg-promise-strict 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/pg-promise-strict.d.ts +207 -207
- package/dist/lib/pg-promise-strict.js +714 -714
- package/package.json +11 -11
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as pg from 'pg';
|
|
3
|
-
import { Stream } from 'stream';
|
|
4
|
-
export declare var messages: {
|
|
5
|
-
attemptTobulkInsertOnNotConnected: string;
|
|
6
|
-
attemptTocopyFromOnNotConnected: string;
|
|
7
|
-
attemptToExecuteSentencesOnNotConnected: string;
|
|
8
|
-
attemptToExecuteSqlScriptOnNotConnected: string;
|
|
9
|
-
clientAlreadyDone: string;
|
|
10
|
-
clientConenctMustNotReceiveParams: string;
|
|
11
|
-
copyFromInlineDumpStreamOptsDoneExperimental: string;
|
|
12
|
-
fetchRowByRowMustReceiveCallback: string;
|
|
13
|
-
formatNullableToInlineDumpErrorParsing: string;
|
|
14
|
-
insaneName: string;
|
|
15
|
-
lackOfClient: string;
|
|
16
|
-
mustNotConnectClientFromPool: string;
|
|
17
|
-
mustNotEndClientFromPool: string;
|
|
18
|
-
nullInQuoteLiteral: string;
|
|
19
|
-
obtains1: string;
|
|
20
|
-
obtainsNone: string;
|
|
21
|
-
queryExpectsOneFieldAnd1: string;
|
|
22
|
-
queryExpectsOneRowAnd1: string;
|
|
23
|
-
queryMustNotBeCatched: string;
|
|
24
|
-
queryMustNotBeThened: string;
|
|
25
|
-
queryNotConnected: string;
|
|
26
|
-
unbalancedConnection: string;
|
|
27
|
-
};
|
|
28
|
-
export declare var i18n: {
|
|
29
|
-
messages: {
|
|
30
|
-
en: typeof messages;
|
|
31
|
-
[k: string]: Partial<typeof messages>;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export declare function setLang(lang: string): void;
|
|
35
|
-
export declare var debug: {
|
|
36
|
-
pool?: true | {
|
|
37
|
-
[key: string]: {
|
|
38
|
-
count: number;
|
|
39
|
-
client: (pg.Client | pg.PoolClient) & {
|
|
40
|
-
secretKey: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare var defaults: {
|
|
46
|
-
releaseTimeout: {
|
|
47
|
-
inactive: number;
|
|
48
|
-
connection: number;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
export declare function noLog(_message: string, _type: string): void;
|
|
52
|
-
export declare var log: (message: string, type: string) => void;
|
|
53
|
-
export declare var alsoLogRows: boolean;
|
|
54
|
-
export declare var logExceptions: boolean;
|
|
55
|
-
export declare function quoteIdent(name: string): string;
|
|
56
|
-
export declare function quoteIdentList(objectNames: string[]): string;
|
|
57
|
-
export type AnyQuoteable = string | number | Date | {
|
|
58
|
-
isRealDate: boolean;
|
|
59
|
-
toYmd: () => string;
|
|
60
|
-
} | {
|
|
61
|
-
toPostgres: () => string;
|
|
62
|
-
} | {
|
|
63
|
-
toString: () => string;
|
|
64
|
-
};
|
|
65
|
-
export declare function quoteNullable(anyValue: null | AnyQuoteable): string;
|
|
66
|
-
export declare function quoteLiteral(anyValue: AnyQuoteable): string;
|
|
67
|
-
export declare const param3rd4sql: (exprOrWithoutkeyOrKeys?: string | true | string[], base?: string, keys?: string | string[]) => string;
|
|
68
|
-
export declare function json(sql: string, orderby: string, expr: string): string;
|
|
69
|
-
export declare function json(sql: string, orderby: string, keys: string[]): string;
|
|
70
|
-
export declare function json(sql: string, orderby: string, withoutKeys: true): string;
|
|
71
|
-
export declare function json(sql: string, orderby: string): string;
|
|
72
|
-
export declare function jsono(sql: string, indexedby: string, expr: string): string;
|
|
73
|
-
export declare function jsono(sql: string, indexedby: string, keys: string[]): string;
|
|
74
|
-
export declare function jsono(sql: string, indexedby: string, withoutKeys: true): string;
|
|
75
|
-
export declare function jsono(sql: string, indexedby: string): string;
|
|
76
|
-
export declare function adaptParameterTypes(parameters?: any[]): any[] | null;
|
|
77
|
-
export declare var easy: boolean;
|
|
78
|
-
export type ConnectParams = {
|
|
79
|
-
motor?: "postgres";
|
|
80
|
-
database?: string;
|
|
81
|
-
user?: string;
|
|
82
|
-
password?: string;
|
|
83
|
-
port?: number;
|
|
84
|
-
};
|
|
85
|
-
export type CopyFromOptsCommon = {
|
|
86
|
-
table: string;
|
|
87
|
-
columns?: string[];
|
|
88
|
-
done?: (err?: Error) => void;
|
|
89
|
-
with?: string;
|
|
90
|
-
};
|
|
91
|
-
export type CopyFromOptsFile = {
|
|
92
|
-
inStream?: undefined;
|
|
93
|
-
filename: string;
|
|
94
|
-
} & CopyFromOptsCommon;
|
|
95
|
-
export type CopyFromOptsStream = {
|
|
96
|
-
inStream: Stream;
|
|
97
|
-
filename?: undefined;
|
|
98
|
-
} & CopyFromOptsCommon;
|
|
99
|
-
export type CopyFromOpts = CopyFromOptsFile | CopyFromOptsStream;
|
|
100
|
-
export type BulkInsertParams = {
|
|
101
|
-
schema?: string;
|
|
102
|
-
table: string;
|
|
103
|
-
columns: string[];
|
|
104
|
-
rows: any[][];
|
|
105
|
-
onerror?: (err: Error, row: any[]) => Promise<void>;
|
|
106
|
-
};
|
|
107
|
-
export type Column = {
|
|
108
|
-
data_type: string;
|
|
109
|
-
};
|
|
110
|
-
export declare class InformationSchemaReader {
|
|
111
|
-
private client;
|
|
112
|
-
constructor(client: Client);
|
|
113
|
-
column(table_schema: string, table_name: string, column_name: string): Promise<Column | null>;
|
|
114
|
-
}
|
|
115
|
-
/** TODO: any en opts */
|
|
116
|
-
export declare class Client {
|
|
117
|
-
private _done?;
|
|
118
|
-
private connected;
|
|
119
|
-
private fromPool;
|
|
120
|
-
private postConnect;
|
|
121
|
-
private _client;
|
|
122
|
-
private _informationSchema;
|
|
123
|
-
constructor(connOpts: ConnectParams);
|
|
124
|
-
constructor(connOpts: null, client: (pg.Client | pg.PoolClient), _done: () => void, _opts?: any);
|
|
125
|
-
connect(): Promise<unknown>;
|
|
126
|
-
end(): void;
|
|
127
|
-
done(): void;
|
|
128
|
-
query(sql: string): Query;
|
|
129
|
-
query(sql: string, params: any[]): Query;
|
|
130
|
-
query(sqlObject: {
|
|
131
|
-
text: string;
|
|
132
|
-
values: any[];
|
|
133
|
-
}): Query;
|
|
134
|
-
get informationSchema(): InformationSchemaReader;
|
|
135
|
-
executeSentences(sentences: string[]): Promise<void | ResultCommand>;
|
|
136
|
-
executeSqlScript(fileName: string): Promise<void | ResultCommand>;
|
|
137
|
-
bulkInsert(params: BulkInsertParams): Promise<void>;
|
|
138
|
-
copyFromParseParams(opts: CopyFromOpts): {
|
|
139
|
-
sql: string;
|
|
140
|
-
_client: (pg.Client | pg.PoolClient) & {
|
|
141
|
-
secretKey: string;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
copyFromFile(opts: CopyFromOptsFile): Promise<ResultCommand>;
|
|
145
|
-
copyFromInlineDumpStream(opts: CopyFromOptsStream): import("pg-copy-streams").CopyStreamQuery;
|
|
146
|
-
formatNullableToInlineDump(nullable: any): any;
|
|
147
|
-
copyFromArrayStream(opts: CopyFromOptsStream): import("pg-copy-streams").CopyStreamQuery;
|
|
148
|
-
}
|
|
149
|
-
declare var queryResult: pg.QueryResult;
|
|
150
|
-
export interface Result {
|
|
151
|
-
rowCount: number;
|
|
152
|
-
fields: typeof queryResult.fields;
|
|
153
|
-
}
|
|
154
|
-
export interface ResultCommand {
|
|
155
|
-
command: string;
|
|
156
|
-
rowCount: number;
|
|
157
|
-
}
|
|
158
|
-
export interface ResultOneRow extends Result {
|
|
159
|
-
row: {
|
|
160
|
-
[key: string]: any;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
export interface ResultOneRowIfExists extends Result {
|
|
164
|
-
row?: {
|
|
165
|
-
[key: string]: any;
|
|
166
|
-
} | null;
|
|
167
|
-
}
|
|
168
|
-
export interface ResultRows extends Result {
|
|
169
|
-
rows: {
|
|
170
|
-
[key: string]: any;
|
|
171
|
-
}[];
|
|
172
|
-
}
|
|
173
|
-
export interface ResultValue extends Result {
|
|
174
|
-
value: any;
|
|
175
|
-
}
|
|
176
|
-
export type ResultGeneric = ResultValue | ResultRows | ResultOneRowIfExists | ResultOneRow | Result | ResultCommand;
|
|
177
|
-
type Notice = string;
|
|
178
|
-
declare class Query {
|
|
179
|
-
private _query;
|
|
180
|
-
client: Client;
|
|
181
|
-
private _internalClient;
|
|
182
|
-
constructor(_query: pg.Query, client: Client, _internalClient: pg.Client | pg.PoolClient);
|
|
183
|
-
onNotice(callbackNoticeConsumer: (notice: Notice) => void): Query;
|
|
184
|
-
private _execute;
|
|
185
|
-
fetchUniqueValue(errorMessage?: string): Promise<ResultValue>;
|
|
186
|
-
fetchUniqueRow(errorMessage?: string, acceptNoRows?: boolean): Promise<ResultOneRow>;
|
|
187
|
-
fetchOneRowIfExists(errorMessage?: string): Promise<ResultOneRow>;
|
|
188
|
-
fetchAll(): Promise<ResultRows>;
|
|
189
|
-
execute(): Promise<ResultCommand>;
|
|
190
|
-
fetchRowByRow(cb: (row: {}, result: pg.QueryResult) => Promise<void>): Promise<void>;
|
|
191
|
-
onRow(cb: (row: {}, result: pg.QueryResult) => Promise<void>): Promise<void>;
|
|
192
|
-
then(): void;
|
|
193
|
-
catch(): void;
|
|
194
|
-
}
|
|
195
|
-
export declare var allTypes: boolean;
|
|
196
|
-
export declare function setAllTypes(): void;
|
|
197
|
-
export declare function connect(connectParameters: ConnectParams): Promise<Client>;
|
|
198
|
-
export declare var readyLog: Promise<void>;
|
|
199
|
-
export declare function logLastError(message: string, messageType: string): void;
|
|
200
|
-
export declare namespace logLastError {
|
|
201
|
-
var inFileName: string;
|
|
202
|
-
var receivedMessages: {
|
|
203
|
-
[key: string]: string;
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
export declare function poolBalanceControl(): string;
|
|
207
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as pg from 'pg';
|
|
3
|
+
import { Stream } from 'stream';
|
|
4
|
+
export declare var messages: {
|
|
5
|
+
attemptTobulkInsertOnNotConnected: string;
|
|
6
|
+
attemptTocopyFromOnNotConnected: string;
|
|
7
|
+
attemptToExecuteSentencesOnNotConnected: string;
|
|
8
|
+
attemptToExecuteSqlScriptOnNotConnected: string;
|
|
9
|
+
clientAlreadyDone: string;
|
|
10
|
+
clientConenctMustNotReceiveParams: string;
|
|
11
|
+
copyFromInlineDumpStreamOptsDoneExperimental: string;
|
|
12
|
+
fetchRowByRowMustReceiveCallback: string;
|
|
13
|
+
formatNullableToInlineDumpErrorParsing: string;
|
|
14
|
+
insaneName: string;
|
|
15
|
+
lackOfClient: string;
|
|
16
|
+
mustNotConnectClientFromPool: string;
|
|
17
|
+
mustNotEndClientFromPool: string;
|
|
18
|
+
nullInQuoteLiteral: string;
|
|
19
|
+
obtains1: string;
|
|
20
|
+
obtainsNone: string;
|
|
21
|
+
queryExpectsOneFieldAnd1: string;
|
|
22
|
+
queryExpectsOneRowAnd1: string;
|
|
23
|
+
queryMustNotBeCatched: string;
|
|
24
|
+
queryMustNotBeThened: string;
|
|
25
|
+
queryNotConnected: string;
|
|
26
|
+
unbalancedConnection: string;
|
|
27
|
+
};
|
|
28
|
+
export declare var i18n: {
|
|
29
|
+
messages: {
|
|
30
|
+
en: typeof messages;
|
|
31
|
+
[k: string]: Partial<typeof messages>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function setLang(lang: string): void;
|
|
35
|
+
export declare var debug: {
|
|
36
|
+
pool?: true | {
|
|
37
|
+
[key: string]: {
|
|
38
|
+
count: number;
|
|
39
|
+
client: (pg.Client | pg.PoolClient) & {
|
|
40
|
+
secretKey: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare var defaults: {
|
|
46
|
+
releaseTimeout: {
|
|
47
|
+
inactive: number;
|
|
48
|
+
connection: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare function noLog(_message: string, _type: string): void;
|
|
52
|
+
export declare var log: (message: string, type: string) => void;
|
|
53
|
+
export declare var alsoLogRows: boolean;
|
|
54
|
+
export declare var logExceptions: boolean;
|
|
55
|
+
export declare function quoteIdent(name: string): string;
|
|
56
|
+
export declare function quoteIdentList(objectNames: string[]): string;
|
|
57
|
+
export type AnyQuoteable = string | number | Date | {
|
|
58
|
+
isRealDate: boolean;
|
|
59
|
+
toYmd: () => string;
|
|
60
|
+
} | {
|
|
61
|
+
toPostgres: () => string;
|
|
62
|
+
} | {
|
|
63
|
+
toString: () => string;
|
|
64
|
+
};
|
|
65
|
+
export declare function quoteNullable(anyValue: null | AnyQuoteable): string;
|
|
66
|
+
export declare function quoteLiteral(anyValue: AnyQuoteable): string;
|
|
67
|
+
export declare const param3rd4sql: (exprOrWithoutkeyOrKeys?: string | true | string[], base?: string, keys?: string | string[]) => string;
|
|
68
|
+
export declare function json(sql: string, orderby: string, expr: string): string;
|
|
69
|
+
export declare function json(sql: string, orderby: string, keys: string[]): string;
|
|
70
|
+
export declare function json(sql: string, orderby: string, withoutKeys: true): string;
|
|
71
|
+
export declare function json(sql: string, orderby: string): string;
|
|
72
|
+
export declare function jsono(sql: string, indexedby: string, expr: string): string;
|
|
73
|
+
export declare function jsono(sql: string, indexedby: string, keys: string[]): string;
|
|
74
|
+
export declare function jsono(sql: string, indexedby: string, withoutKeys: true): string;
|
|
75
|
+
export declare function jsono(sql: string, indexedby: string): string;
|
|
76
|
+
export declare function adaptParameterTypes(parameters?: any[]): any[] | null;
|
|
77
|
+
export declare var easy: boolean;
|
|
78
|
+
export type ConnectParams = {
|
|
79
|
+
motor?: "postgres";
|
|
80
|
+
database?: string;
|
|
81
|
+
user?: string;
|
|
82
|
+
password?: string;
|
|
83
|
+
port?: number;
|
|
84
|
+
};
|
|
85
|
+
export type CopyFromOptsCommon = {
|
|
86
|
+
table: string;
|
|
87
|
+
columns?: string[];
|
|
88
|
+
done?: (err?: Error) => void;
|
|
89
|
+
with?: string;
|
|
90
|
+
};
|
|
91
|
+
export type CopyFromOptsFile = {
|
|
92
|
+
inStream?: undefined;
|
|
93
|
+
filename: string;
|
|
94
|
+
} & CopyFromOptsCommon;
|
|
95
|
+
export type CopyFromOptsStream = {
|
|
96
|
+
inStream: Stream;
|
|
97
|
+
filename?: undefined;
|
|
98
|
+
} & CopyFromOptsCommon;
|
|
99
|
+
export type CopyFromOpts = CopyFromOptsFile | CopyFromOptsStream;
|
|
100
|
+
export type BulkInsertParams = {
|
|
101
|
+
schema?: string;
|
|
102
|
+
table: string;
|
|
103
|
+
columns: string[];
|
|
104
|
+
rows: any[][];
|
|
105
|
+
onerror?: (err: Error, row: any[]) => Promise<void>;
|
|
106
|
+
};
|
|
107
|
+
export type Column = {
|
|
108
|
+
data_type: string;
|
|
109
|
+
};
|
|
110
|
+
export declare class InformationSchemaReader {
|
|
111
|
+
private client;
|
|
112
|
+
constructor(client: Client);
|
|
113
|
+
column(table_schema: string, table_name: string, column_name: string): Promise<Column | null>;
|
|
114
|
+
}
|
|
115
|
+
/** TODO: any en opts */
|
|
116
|
+
export declare class Client {
|
|
117
|
+
private _done?;
|
|
118
|
+
private connected;
|
|
119
|
+
private fromPool;
|
|
120
|
+
private postConnect;
|
|
121
|
+
private _client;
|
|
122
|
+
private _informationSchema;
|
|
123
|
+
constructor(connOpts: ConnectParams);
|
|
124
|
+
constructor(connOpts: null, client: (pg.Client | pg.PoolClient), _done: () => void, _opts?: any);
|
|
125
|
+
connect(): Promise<unknown>;
|
|
126
|
+
end(): void;
|
|
127
|
+
done(): void;
|
|
128
|
+
query(sql: string): Query;
|
|
129
|
+
query(sql: string, params: any[]): Query;
|
|
130
|
+
query(sqlObject: {
|
|
131
|
+
text: string;
|
|
132
|
+
values: any[];
|
|
133
|
+
}): Query;
|
|
134
|
+
get informationSchema(): InformationSchemaReader;
|
|
135
|
+
executeSentences(sentences: string[]): Promise<void | ResultCommand>;
|
|
136
|
+
executeSqlScript(fileName: string): Promise<void | ResultCommand>;
|
|
137
|
+
bulkInsert(params: BulkInsertParams): Promise<void>;
|
|
138
|
+
copyFromParseParams(opts: CopyFromOpts): {
|
|
139
|
+
sql: string;
|
|
140
|
+
_client: (pg.Client | pg.PoolClient) & {
|
|
141
|
+
secretKey: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
copyFromFile(opts: CopyFromOptsFile): Promise<ResultCommand>;
|
|
145
|
+
copyFromInlineDumpStream(opts: CopyFromOptsStream): import("pg-copy-streams").CopyStreamQuery;
|
|
146
|
+
formatNullableToInlineDump(nullable: any): any;
|
|
147
|
+
copyFromArrayStream(opts: CopyFromOptsStream): import("pg-copy-streams").CopyStreamQuery;
|
|
148
|
+
}
|
|
149
|
+
declare var queryResult: pg.QueryResult;
|
|
150
|
+
export interface Result {
|
|
151
|
+
rowCount: number;
|
|
152
|
+
fields: typeof queryResult.fields;
|
|
153
|
+
}
|
|
154
|
+
export interface ResultCommand {
|
|
155
|
+
command: string;
|
|
156
|
+
rowCount: number;
|
|
157
|
+
}
|
|
158
|
+
export interface ResultOneRow extends Result {
|
|
159
|
+
row: {
|
|
160
|
+
[key: string]: any;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export interface ResultOneRowIfExists extends Result {
|
|
164
|
+
row?: {
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
} | null;
|
|
167
|
+
}
|
|
168
|
+
export interface ResultRows extends Result {
|
|
169
|
+
rows: {
|
|
170
|
+
[key: string]: any;
|
|
171
|
+
}[];
|
|
172
|
+
}
|
|
173
|
+
export interface ResultValue extends Result {
|
|
174
|
+
value: any;
|
|
175
|
+
}
|
|
176
|
+
export type ResultGeneric = ResultValue | ResultRows | ResultOneRowIfExists | ResultOneRow | Result | ResultCommand;
|
|
177
|
+
type Notice = string;
|
|
178
|
+
declare class Query {
|
|
179
|
+
private _query;
|
|
180
|
+
client: Client;
|
|
181
|
+
private _internalClient;
|
|
182
|
+
constructor(_query: pg.Query, client: Client, _internalClient: pg.Client | pg.PoolClient);
|
|
183
|
+
onNotice(callbackNoticeConsumer: (notice: Notice) => void): Query;
|
|
184
|
+
private _execute;
|
|
185
|
+
fetchUniqueValue(errorMessage?: string): Promise<ResultValue>;
|
|
186
|
+
fetchUniqueRow(errorMessage?: string, acceptNoRows?: boolean): Promise<ResultOneRow>;
|
|
187
|
+
fetchOneRowIfExists(errorMessage?: string): Promise<ResultOneRow>;
|
|
188
|
+
fetchAll(): Promise<ResultRows>;
|
|
189
|
+
execute(): Promise<ResultCommand>;
|
|
190
|
+
fetchRowByRow(cb: (row: {}, result: pg.QueryResult) => Promise<void>): Promise<void>;
|
|
191
|
+
onRow(cb: (row: {}, result: pg.QueryResult) => Promise<void>): Promise<void>;
|
|
192
|
+
then(): void;
|
|
193
|
+
catch(): void;
|
|
194
|
+
}
|
|
195
|
+
export declare var allTypes: boolean;
|
|
196
|
+
export declare function setAllTypes(): void;
|
|
197
|
+
export declare function connect(connectParameters: ConnectParams): Promise<Client>;
|
|
198
|
+
export declare var readyLog: Promise<void>;
|
|
199
|
+
export declare function logLastError(message: string, messageType: string): void;
|
|
200
|
+
export declare namespace logLastError {
|
|
201
|
+
var inFileName: string;
|
|
202
|
+
var receivedMessages: {
|
|
203
|
+
[key: string]: string;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
export declare function poolBalanceControl(): string;
|
|
207
|
+
export {};
|