Skip to content

Commit 7d73624

Browse files
committed
full
1 parent d7a41c3 commit 7d73624

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

full/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# libpg-query
1+
# @libpg-query/parser
22

33
<p align="center" width="100%">
44
<img src="https://github.com/launchql/libpg-query-node/assets/545047/5fd420cc-cdc6-4211-9b0f-0eca8321ba72" alt="webincubator" width="100">
@@ -8,7 +8,7 @@
88
<a href="https://www.npmjs.com/package/libpg-query"><img height="20" src="https://img.shields.io/npm/dt/libpg-query"></a>
99
<a href="https://www.npmjs.com/package/libpg-query"><img height="20" src="https://img.shields.io/npm/dw/libpg-query"/></a>
1010
<a href="https://github.com/launchql/libpg-query/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
11-
<a href="https://www.npmjs.com/package/libpg-query"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=libpg-query%2Fpackage.json"/></a><br />
11+
<a href="https://www.npmjs.com/package/libpg-query"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=full%2Fpackage.json"/></a><br />
1212
<a href="https://github.com/launchql/libpg-query-node/actions/workflows/ci.yml"><img height="20" src="https://github.com/launchql/libpg-query-node/actions/workflows/ci.yml/badge.svg" /></a>
1313
<a href="https://github.com/launchql/libpg-query-node/actions/workflows/ci.yml"><img height="20" src="https://img.shields.io/badge/macOS-available-333333?logo=apple&logoColor=white" /></a>
1414
<a href="https://github.com/launchql/libpg-query-node/actions/workflows/ci.yml"><img height="20" src="https://img.shields.io/badge/Windows-available-333333?logo=windows&logoColor=white" /></a>
@@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this
3535
## Installation
3636

3737
```sh
38-
npm install libpg-query
38+
npm install @libpg-query/parser
3939
```
4040

4141
## Usage
@@ -45,7 +45,7 @@ npm install libpg-query
4545
Parses the SQL and returns a Promise for the parse tree. May reject with a parse error.
4646

4747
```typescript
48-
import { parse } from 'libpg-query';
48+
import { parse } from '@libpg-query/parser';
4949

5050
const result = await parse('SELECT * FROM users WHERE active = true');
5151
// Returns: ParseResult - parsed query object
@@ -56,7 +56,7 @@ const result = await parse('SELECT * FROM users WHERE active = true');
5656
Synchronous version that returns the parse tree directly. May throw a parse error.
5757

5858
```typescript
59-
import { parseSync } from 'libpg-query';
59+
import { parseSync } from '@libpg-query/parser';
6060

6161
const result = parseSync('SELECT * FROM users WHERE active = true');
6262
// Returns: ParseResult - parsed query object
@@ -67,7 +67,7 @@ const result = parseSync('SELECT * FROM users WHERE active = true');
6767
Parses the contents of a PL/pgSQL function from a `CREATE FUNCTION` declaration. Returns a Promise for the parse tree.
6868

6969
```typescript
70-
import { parsePlPgSQL } from 'libpg-query';
70+
import { parsePlPgSQL } from '@libpg-query/parser';
7171

7272
const functionSql = `
7373
CREATE FUNCTION get_user_count() RETURNS integer AS $$
@@ -85,7 +85,7 @@ const result = await parsePlPgSQL(functionSql);
8585
Synchronous version of PL/pgSQL parsing.
8686

8787
```typescript
88-
import { parsePlPgSQLSync } from 'libpg-query';
88+
import { parsePlPgSQLSync } from '@libpg-query/parser';
8989

9090
const result = parsePlPgSQLSync(functionSql);
9191
```
@@ -95,7 +95,7 @@ const result = parsePlPgSQLSync(functionSql);
9595
Converts a parse tree back to SQL string. Returns a Promise for the SQL string.
9696

9797
```typescript
98-
import { parse, deparse } from 'libpg-query';
98+
import { parse, deparse } from '@libpg-query/parser';
9999

100100
const parseTree = await parse('SELECT * FROM users WHERE active = true');
101101
const sql = await deparse(parseTree);
@@ -107,7 +107,7 @@ const sql = await deparse(parseTree);
107107
Synchronous version that converts a parse tree back to SQL string directly.
108108

109109
```typescript
110-
import { parseSync, deparseSync } from 'libpg-query';
110+
import { parseSync, deparseSync } from '@libpg-query/parser';
111111

112112
const parseTree = parseSync('SELECT * FROM users WHERE active = true');
113113
const sql = deparseSync(parseTree);
@@ -119,7 +119,7 @@ const sql = deparseSync(parseTree);
119119
Generates a unique fingerprint for a SQL query that can be used for query identification and caching. Returns a Promise for a 16-character fingerprint string.
120120

121121
```typescript
122-
import { fingerprint } from 'libpg-query';
122+
import { fingerprint } from '@libpg-query/parser';
123123

124124
const fp = await fingerprint('SELECT * FROM users WHERE active = $1');
125125
// Returns: string - unique 16-character fingerprint (e.g., "50fde20626009aba")
@@ -130,7 +130,7 @@ const fp = await fingerprint('SELECT * FROM users WHERE active = $1');
130130
Synchronous version that generates a unique fingerprint for a SQL query directly.
131131

132132
```typescript
133-
import { fingerprintSync } from 'libpg-query';
133+
import { fingerprintSync } from '@libpg-query/parser';
134134

135135
const fp = fingerprintSync('SELECT * FROM users WHERE active = $1');
136136
// Returns: string - unique 16-character fingerprint
@@ -141,7 +141,7 @@ const fp = fingerprintSync('SELECT * FROM users WHERE active = $1');
141141
Normalizes a SQL query by removing comments, standardizing whitespace, and converting to a canonical form. Returns a Promise for the normalized SQL string.
142142

143143
```typescript
144-
import { normalize } from 'libpg-query';
144+
import { normalize } from '@libpg-query/parser';
145145

146146
const normalized = await normalize('SELECT * FROM users WHERE active = true');
147147
// Returns: string - normalized SQL query
@@ -152,7 +152,7 @@ const normalized = await normalize('SELECT * FROM users WHERE active = true');
152152
Synchronous version that normalizes a SQL query directly.
153153

154154
```typescript
155-
import { normalizeSync } from 'libpg-query';
155+
import { normalizeSync } from '@libpg-query/parser';
156156

157157
const normalized = normalizeSync('SELECT * FROM users WHERE active = true');
158158
// Returns: string - normalized SQL query
@@ -163,7 +163,7 @@ const normalized = normalizeSync('SELECT * FROM users WHERE active = true');
163163
Scans (tokenizes) a SQL query and returns detailed information about each token. Returns a Promise for a ScanResult containing all tokens with their positions, types, and classifications.
164164

165165
```typescript
166-
import { scan } from 'libpg-query';
166+
import { scan } from '@libpg-query/parser';
167167

168168
const result = await scan('SELECT * FROM users WHERE id = $1');
169169
// Returns: ScanResult - detailed tokenization information
@@ -175,7 +175,7 @@ console.log(result.tokens[0]); // { start: 0, end: 6, text: "SELECT", tokenType:
175175
Synchronous version that scans (tokenizes) a SQL query directly.
176176

177177
```typescript
178-
import { scanSync } from 'libpg-query';
178+
import { scanSync } from '@libpg-query/parser';
179179

180180
const result = scanSync('SELECT * FROM users WHERE id = $1');
181181
// Returns: ScanResult - detailed tokenization information
@@ -190,7 +190,7 @@ The library provides both async and sync methods. Async methods handle initializ
190190
Async methods handle initialization automatically and are always safe to use:
191191

192192
```typescript
193-
import { parse, deparse, scan } from 'libpg-query';
193+
import { parse, deparse, scan } from '@libpg-query/parser';
194194

195195
// These handle initialization automatically
196196
const result = await parse('SELECT * FROM users');
@@ -203,7 +203,7 @@ const tokens = await scan('SELECT * FROM users');
203203
Sync methods require explicit initialization using `loadModule()`:
204204

205205
```typescript
206-
import { loadModule, parseSync, scanSync } from 'libpg-query';
206+
import { loadModule, parseSync, scanSync } from '@libpg-query/parser';
207207

208208
// Initialize first
209209
await loadModule();
@@ -218,7 +218,7 @@ const tokens = scanSync('SELECT * FROM users');
218218
Explicitly initializes the WASM module. Required before using any sync methods.
219219

220220
```typescript
221-
import { loadModule, parseSync, scanSync } from 'libpg-query';
221+
import { loadModule, parseSync, scanSync } from '@libpg-query/parser';
222222

223223
// Initialize before using sync methods
224224
await loadModule();

0 commit comments

Comments
 (0)