@opengis/fastify-table 1.0.54 → 1.0.55
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/Changelog.md +4 -0
- package/package.json +1 -1
- package/pg/funcs/init.js +18 -1
package/Changelog.md
CHANGED
package/package.json
CHANGED
package/pg/funcs/init.js
CHANGED
|
@@ -20,6 +20,23 @@ async function init(client) {
|
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
async function queryNotice(query, args = [], cb = () => { }) {
|
|
24
|
+
const clientCb = await client.connect();
|
|
25
|
+
clientCb.on('notice', (e) => {
|
|
26
|
+
cb(e.message);
|
|
27
|
+
});
|
|
28
|
+
let result;
|
|
29
|
+
try {
|
|
30
|
+
result = await clientCb.query(query, args);
|
|
31
|
+
clientCb.end();
|
|
32
|
+
} catch (err) {
|
|
33
|
+
clientCb.end();
|
|
34
|
+
cb(err.toString(), 1);
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
async function queryCache(query) {
|
|
24
41
|
const rclient = getRedis({ db: 0 });
|
|
25
42
|
const hash = crypto.createHash('sha1').update(query).digest('base64');
|
|
@@ -34,7 +51,7 @@ async function init(client) {
|
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
Object.assign(client, {
|
|
37
|
-
one, pgType, pk, tlist, queryCache,
|
|
54
|
+
one, pgType, pk, tlist, queryCache, queryNotice,
|
|
38
55
|
});
|
|
39
56
|
}
|
|
40
57
|
|