Skip to content

Commit 266c507

Browse files
committed
README
1 parent a07e4d5 commit 266c507

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ console.log(JSON.stringify(ast, null, 2));
6666
```typescript
6767
import { deparse } from 'pgsql-deparser';
6868

69-
const sql = deparse(ast);
69+
const sql = await deparse(ast);
7070
console.log(sql); // SELECT * FROM users WHERE id = 1
7171
```
7272

7373
#### Build AST Programmatically
7474
```typescript
7575
import * as t from '@pgsql/utils';
76+
import { deparse } from 'pgsql-deparser';
7677
import { SelectStmt } from '@pgsql/types';
7778

7879
const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
@@ -93,10 +94,14 @@ const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
9394
limitOption: 'LIMIT_OPTION_DEFAULT',
9495
op: 'SETOP_NONE'
9596
});
97+
98+
await deparse(stmt);
9699
```
97100

98101
#### Use the CLI
99102
```bash
103+
npm install -g @pgsql/cli
104+
100105
# Parse SQL file
101106
pgsql parse query.sql
102107

@@ -107,17 +112,9 @@ pgsql deparse ast.json
107112
pgsql proto-gen --inFile pg_query.proto --outDir out --types --enums
108113
```
109114

110-
### Package Relationships
111-
112-
- **pgsql-parser** provides full parsing and deparsing capabilities using the actual PostgreSQL parser
113-
- **pgsql-deparser** offers a lightweight alternative for just converting AST to SQL
114-
- **@pgsql/utils** helps construct ASTs programmatically with type safety
115-
- **pg-proto-parser** generates TypeScript definitions from PostgreSQL protobuf files
116-
- **@pgsql/cli** unifies all functionality into a single command-line tool
117-
118115
## 🛠️ Development
119116

120-
This project uses Yarn workspaces and Lerna for monorepo management.
117+
This project uses Yarn workspaces and Lerna for monorepo management. See [DEVELOPMENT.md](DEVELOPMENT.md) for more info.
121118

122119
### Setup
123120
```bash
@@ -134,17 +131,8 @@ cd packages/parser
134131
npm run build
135132
```
136133

137-
## Documentation
138-
139-
Each package has its own detailed README:
140-
141-
- [`pgsql-parser`](./packages/parser/README.md)
142-
- [`pgsql-deparser`](./packages/deparser/README.md)
143-
- [`@pgsql/cli`](./packages/pgsql-cli/README.md)
144-
- [`@pgsql/utils`](./packages/utils/README.md)
145-
- [`pg-proto-parser`](./packages/proto-parser/README.md)
146134

147-
## Examples
135+
## More Examples
148136

149137
### Transform a Query
150138

0 commit comments

Comments
 (0)