@sprucelabs/postgres-data-store 5.0.2 → 5.1.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Database, Index, QueryOptions, UniqueIndex } from '@sprucelabs/data-stores';
|
|
2
|
-
import { Client
|
|
2
|
+
import { Client } from 'pg';
|
|
3
3
|
export default class PostgresDatabase implements Database {
|
|
4
4
|
private connectionString;
|
|
5
5
|
protected client: Client;
|
|
@@ -43,5 +43,5 @@ export default class PostgresDatabase implements Database {
|
|
|
43
43
|
close(): Promise<void>;
|
|
44
44
|
isConnected(): boolean;
|
|
45
45
|
private parseIndexViolatedForFieldsAndValues;
|
|
46
|
-
query<T
|
|
46
|
+
query<T>(query: string, params?: any[]): Promise<T>;
|
|
47
47
|
}
|
|
@@ -369,10 +369,12 @@ class PostgresDatabase {
|
|
|
369
369
|
const result = { fields: fixedFields, values };
|
|
370
370
|
return result;
|
|
371
371
|
}
|
|
372
|
-
async query(query) {
|
|
373
|
-
|
|
372
|
+
async query(query, params) {
|
|
373
|
+
const results = await this.client.query({
|
|
374
374
|
text: query,
|
|
375
|
-
|
|
375
|
+
values: params,
|
|
376
|
+
});
|
|
377
|
+
return results.rows;
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
exports.default = PostgresDatabase;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Database, Index, QueryOptions, UniqueIndex } from '@sprucelabs/data-stores';
|
|
2
|
-
import { Client
|
|
2
|
+
import { Client } from 'pg';
|
|
3
3
|
export default class PostgresDatabase implements Database {
|
|
4
4
|
private connectionString;
|
|
5
5
|
protected client: Client;
|
|
@@ -43,5 +43,5 @@ export default class PostgresDatabase implements Database {
|
|
|
43
43
|
close(): Promise<void>;
|
|
44
44
|
isConnected(): boolean;
|
|
45
45
|
private parseIndexViolatedForFieldsAndValues;
|
|
46
|
-
query<T
|
|
46
|
+
query<T>(query: string, params?: any[]): Promise<T>;
|
|
47
47
|
}
|
|
@@ -411,11 +411,13 @@ export default class PostgresDatabase {
|
|
|
411
411
|
const result = { fields: fixedFields, values };
|
|
412
412
|
return result;
|
|
413
413
|
}
|
|
414
|
-
query(query) {
|
|
414
|
+
query(query, params) {
|
|
415
415
|
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
-
|
|
416
|
+
const results = yield this.client.query({
|
|
417
417
|
text: query,
|
|
418
|
-
|
|
418
|
+
values: params,
|
|
419
|
+
});
|
|
420
|
+
return results.rows;
|
|
419
421
|
});
|
|
420
422
|
}
|
|
421
423
|
}
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sprucebot",
|
|
23
23
|
"sprucelabs"
|
|
24
24
|
],
|
|
25
|
-
"version": "5.0
|
|
25
|
+
"version": "5.1.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build.ci": "yarn build.tsc && yarn build.resolve-paths && yarn lint",
|
|
28
28
|
"build.dev": "yarn build.tsc --sourceMap ; yarn resolve-paths.lint",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"watch.tsc": "tsc -w"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@sprucelabs/data-stores": "^26.
|
|
54
|
+
"@sprucelabs/data-stores": "^26.3.0",
|
|
55
55
|
"@sprucelabs/schema": "^29.3.0",
|
|
56
56
|
"pg": "^8.11.3"
|
|
57
57
|
},
|