syntaqlite 0.0.24 → 0.0.26
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.
- package/README.md +46 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# syntaqlite
|
|
2
|
+
|
|
3
|
+
SQLite SQL parser, formatter, and validator for the browser — powered by WebAssembly.
|
|
4
|
+
|
|
5
|
+
Built from SQLite's own grammar for 100% syntax compatibility.
|
|
6
|
+
|
|
7
|
+
- **Format** SQL with configurable line width, keyword casing, and semicolons
|
|
8
|
+
- **Parse** SQL into a full concrete syntax tree
|
|
9
|
+
- **Validate** SQL with diagnostics for unknown tables, columns, and functions
|
|
10
|
+
- **Complete** keywords, table names, column names, and functions
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install syntaqlite
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Engine } from "syntaqlite";
|
|
22
|
+
|
|
23
|
+
const engine = new Engine();
|
|
24
|
+
await engine.init();
|
|
25
|
+
|
|
26
|
+
// Format SQL
|
|
27
|
+
const result = engine.format("select id,name from users where id=1");
|
|
28
|
+
console.log(result.sql);
|
|
29
|
+
// SELECT id, name FROM users WHERE id = 1
|
|
30
|
+
|
|
31
|
+
// Parse SQL to AST (JSON)
|
|
32
|
+
const ast = engine.astJson("SELECT 1");
|
|
33
|
+
console.log(ast);
|
|
34
|
+
|
|
35
|
+
// Validate SQL
|
|
36
|
+
const diagnostics = engine.diagnostics("SELECT * FROM missing_table");
|
|
37
|
+
console.log(diagnostics.entries);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
See [syntaqlite.com](https://syntaqlite.com) for full documentation.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
Apache-2.0
|