@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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # fastify-table
2
2
 
3
+ ## 1.0.55 - 02.07.2024
4
+
5
+ - callback support
6
+
3
7
  ## 1.0.54 - 01.07.2024
4
8
 
5
9
  - code optimization
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",
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