You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,20 +97,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
97
97
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/launchql/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
Copy file name to clipboardExpand all lines: packages/deparser/README.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,20 +35,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
35
35
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/launchql/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
Copy file name to clipboardExpand all lines: packages/parser/README.md
+13-21Lines changed: 13 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,27 +33,18 @@ npm install pgsql-parser
33
33
34
34
The package exports both async and sync methods. Async methods handle initialization automatically, while sync methods require explicit initialization.
35
35
36
-
⚠️ We recommend using `@pgsql/deparser` instead of `deparse` from `pgsql-parser`. The deparser package is more complete, supports sub-expressions, and doesn't require the WebAssembly module, making it lighter and more flexible for most use cases. It will soon be deprecated, in a minor version bump.
36
+
⚠️ If you don't need the parser functionality, consider using the TS-only (no WASM, zero dependencies) [`pgsql-deparser`](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser) for a super fast, lightweight deparser. Battle-tested with 23,000+ SQL statements 🚀
const stmts =awaitparse('SELECT * FROM test_table');
45
45
46
46
// Deparse AST back to SQL
47
47
const sql =awaitdeparse(stmts);
48
-
49
-
// Parse PL/pgSQL functions
50
-
const funcAst =awaitparseFunction(`
51
-
CREATE FUNCTION get_count() RETURNS integer AS $$
52
-
BEGIN
53
-
RETURN (SELECT COUNT(*) FROM users);
54
-
END;
55
-
$$ LANGUAGE plpgsql;
56
-
`);
57
48
```
58
49
59
50
### Sync Methods
@@ -97,20 +88,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
97
88
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/launchql/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
0 commit comments