@pgsql/utils 17.6.2 → 17.7.1

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.
Files changed (2) hide show
  1. package/README.md +6 -6
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -61,7 +61,7 @@ Explore the PostgreSQL Abstract Syntax Tree (AST) as JSON objects with ease usin
61
61
  ```ts
62
62
  import * as t from '@pgsql/utils';
63
63
  import { SelectStmt } from '@pgsql/types';
64
- import { deparseSync as deparse } from 'pgsql-deparser';
64
+ import { deparse } from 'pgsql-deparser';
65
65
 
66
66
  const selectStmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
67
67
  targetList: [
@@ -83,7 +83,7 @@ const selectStmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
83
83
  });
84
84
  console.log(selectStmt);
85
85
  // Output: { "SelectStmt": { "targetList": [ { "ResTarget": { "val": { "ColumnRef": { "fields": [ { "A_Star": {} } ] } } } } ], "fromClause": [ { "RangeVar": { "relname": "some_amazing_table", "inh": true, "relpersistence": "p" } } ], "limitOption": "LIMIT_OPTION_DEFAULT", "op": "SETOP_NONE" } }
86
- console.log(deparse(stmt))
86
+ console.log(await deparse(stmt))
87
87
  // Output: SELECT * FROM some_amazing_table
88
88
  ```
89
89
 
@@ -91,8 +91,8 @@ console.log(deparse(stmt))
91
91
 
92
92
  ```ts
93
93
  import * as t from '@pgsql/utils';
94
- import { RangeVar, SelectStmt } from '@pgsql/types';
95
- import { deparseSync as deparse } from 'pgsql-deparser';
94
+ import { SelectStmt } from '@pgsql/types';
95
+ import { deparse } from 'pgsql-deparser';
96
96
 
97
97
  const query: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
98
98
  targetList: [
@@ -128,7 +128,7 @@ const query: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
128
128
  op: 'SETOP_NONE'
129
129
  });
130
130
 
131
- deparse(createStmt, {});
131
+ await deparse(createStmt);
132
132
  // SELECT name, email FROM users WHERE age > 18
133
133
  ```
134
134
 
@@ -167,7 +167,7 @@ const createStmt = t.nodes.createStmt({
167
167
  });
168
168
 
169
169
  // `deparse` function converts AST to SQL string
170
- const sql = deparse(createStmt);
170
+ const sql = await deparse(createStmt, { pretty: true });
171
171
 
172
172
  console.log(sql);
173
173
  // OUTPUT:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgsql/utils",
3
- "version": "17.6.2",
3
+ "version": "17.7.1",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "PostgreSQL AST utils for pgsql-parser",
6
6
  "main": "index.js",
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "pg-proto-parser": "^1.29.0",
35
- "pgsql-deparser": "^17.7.2"
35
+ "pgsql-deparser": "^17.8.1"
36
36
  },
37
37
  "dependencies": {
38
38
  "@pgsql/types": "^17.6.1",
39
39
  "nested-obj": "0.0.1"
40
40
  },
41
41
  "keywords": [],
42
- "gitHead": "e191d2f1ca9257a70f7cb052552f3546691d2ef6"
42
+ "gitHead": "cffd419f76ad6975c89e7e4f79972f7f27b0eab7"
43
43
  }