Skip to content

Commit e719cdd

Browse files
committed
docs: why section
1 parent fd56a5a commit e719cdd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ Postgres SQL parser that can run anywhere (Browser, Node.js, Deno, Bun, etc.).
99
- **Multi-version:** Supports multiple Postgres versions at runtime (15, 16, 17)
1010
- **Multi-runtime:** Works on any modern JavaScript runtime (Browser, Node.js, Deno, Bun, etc.)
1111

12+
## Why?
13+
14+
There are other great JavaScript Postgres SQL parsers, but we wanted a few missing features:
15+
16+
- **Multi-version support:** We wanted to be able to parse SQL queries for different Postgres versions at runtime, not just compile time. This means we can dynamically adapt to a user's Postgres version without needing to install multiple versions of the same package.
17+
- **WASM-based:** We wanted the parser to be portable across all JavaScript runtimes, including the browser, Node.js, Deno, and Bun. This allows us to use the same parser code in both client-side and server-side applications without worrying about compatibility issues or problems installing native dependencies.
18+
1219
## Installation
1320

1421
```bash
@@ -34,6 +41,8 @@ const parser = new PgParser(); // Defaults to latest version (17)
3441
const result = await parser.parse('SELECT * FROM users WHERE id = 1');
3542

3643
console.log(result);
44+
45+
// { version: 170004, stmts: [ ... ] }
3746
```
3847

3948
## API
@@ -104,6 +113,7 @@ The output will be an object that looks like this:
104113

105114
```typescript
106115
{
116+
version: 170004,
107117
stmts: [
108118
{
109119
stmt: {

0 commit comments

Comments
 (0)