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
fix: update playground link in editor playground tutorial
refactor: modify React widget to use new wasm options structure
style: adjust button styles and colors in home page and run example component
feat: add LayerDiagram component to visualize architecture layers
style: enhance tooltip styling for CodeMirror in both light and dark modes
fix: improve theme handling in RunExample component for better UI consistency
chore: update tokyo night light theme colors for better syntax highlighting
Copy file name to clipboardExpand all lines: README.md
+99-46Lines changed: 99 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,81 +1,136 @@
1
1
# gnata-sqlite
2
2
3
-
End-to-end [JSONata 2.x](https://jsonata.org) in Go — from a loadable SQLite extension to a composable React editor with context-aware autocomplete, everything needed to run, write, and edit JSONata expressions.
3
+
End-to-end [JSONata 2.x](https://jsonata.org) in Go — let end users write their own JSONata expressions against SQLite data, with a composable React editor that provides autocomplete, hover docs, and live diagnostics out of the box.
-**SQLite extension** — `jsonata()`, `jsonata_query()`, `jsonata_each()` as loadable functions with a built-in query planner that matches native SQL performance
14
-
-**React editor widget** — composable hooks and components (`@gnata-sqlite/react`) for embedding a JSONata editor in any app, with autocomplete, hover docs, and live diagnostics
15
-
-**85KB WASM LSP** — TinyGo-compiled language server powering in-browser editor features from the same Go codebase as the native LSP
16
-
-**Context-aware autocomplete** — the editor evaluates prefix expressions against live data to suggest nested keys, enabling end users to explore and write expressions without knowing the schema upfront
17
-
-**5M+ eval ops/sec** — two-tier evaluator with GJSON fast path hitting 10M+ ops/sec for simple paths
12
+
---
18
13
19
-
## Quick Start
14
+
## The Problem
20
15
21
-
```go
22
-
import"github.com/rbbydotdev/gnata-sqlite"
16
+
Applications store JSON in SQLite. Querying and transforming that data requires custom code for every new report, filter, or dashboard widget. End users can't explore the data themselves — they depend on developers to write each query.
gnata-sqlite makes SQLite JSON data queryable with [JSONata](https://jsonata.org) — a lightweight, expressive language end users can learn — and provides everything needed to embed an expression editor in any app:
21
+
22
+
1.**Load the SQLite extension** → JSON columns become queryable with JSONata
23
+
2.**Embed the React editor** → end users write expressions with autocomplete and live feedback
24
+
3.**Connect via schema** → the editor suggests fields from the actual database structure
25
+
26
+
No custom query builder UI. No hardcoded report logic. End users write expressions; the extension runs them.
28
27
29
28
## SQLite Extension
30
29
30
+
A loadable extension that brings JSONata into SQL queries. Install once, use from any SQLite client.
|`jsonata(json, expr)`| Evaluate expression against JSON |
44
-
|`jsonata_query(expr, json)`| Expression-first argument order |
45
-
|`jsonata_each(expr, json)`| Expand results into rows (table-valued) |
48
+
The query planner decomposes complex expressions into streaming accumulators — matching hand-tuned SQL performance on 100K+ rows. See [sqlite/OPTIMIZATION.md](sqlite/OPTIMIZATION.md).
49
+
50
+
| Function | Purpose |
51
+
|----------|---------|
52
+
|`jsonata(json, expr)`| Evaluate per row |
53
+
|`jsonata_query(expr, json)`| Aggregate across rows |
54
+
|`jsonata_each(expr, json)`| Expand results into rows |
46
55
|`jsonata_set(json, path, val)`| Set a value at a path |
47
56
|`jsonata_delete(json, path)`| Delete a value at a path |
48
57
49
-
See [sqlite/README.md](sqlite/README.md) for full docs. Query optimization details in [sqlite/OPTIMIZATION.md](sqlite/OPTIMIZATION.md).
58
+
## React Editor
59
+
60
+
A composable React package (`@gnata-sqlite/react`) for embedding a JSONata expression editor. Developers ship the editor; end users write expressions.
Hover over any function to see its signature, description, and examples — powered by the 85KB TinyGo WASM LSP.
67
+
68
+
### Context-Aware Autocomplete
50
69
51
-
## Benchmarks
70
+
<imgsrc="assets/playground-gnata-autocomplete.png"alt="Autocomplete suggesting Account.Name and Account.Order"width="720" />
52
71
53
-

72
+
Type `Account.` and the editor evaluates the prefix expression against the input data to discover available keys — suggesting `Name`, `Order`, etc. with types.
54
73
55
-

74
+
### Expression Editor
56
75
57
-
<details>
58
-
<summary>Raw numbers (Apple M1)</summary>
76
+
<imgsrc="assets/playground-gnata-transform.png"alt="JSONata transform expression with syntax highlighting"width="720" />
The SQLite extension runs expressions on the backend. The React editor lets end users write those expressions in the browser. The schema protocol connects them.
|[`website/`](website/)| Documentation site (Fumadocs) |
79
134
80
135
## Building
81
136
@@ -88,11 +143,9 @@ make playground # Build WASM + start playground dev server
88
143
make website # Start docs site dev server
89
144
```
90
145
91
-
See `Makefile` for all targets.
92
-
93
146
## Playground
94
147
95
-
Visit the [live playground](https://rbbydotdev.github.io/gnata-sqlite/) for interactive testing of JSONata expressions and the SQLite extension. To run locally:
148
+
Visit the [live playground](https://rbby.dev/gnata-sqlite/playground) to try JSONata expressions against SQLite data in the browser. To run locally:
96
149
97
150
```bash
98
151
cd playground && pnpm install && pnpm dev
@@ -104,7 +157,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
104
157
105
158
## Fork Notice
106
159
107
-
Forked from [RecoLabs/gnata](https://github.com/RecoLabs/gnata), which provides a production-grade JSONata 2.x engine in pure Go. This project extends the core engine with a SQLite extension, editor tooling, and query optimizer.
160
+
Forked from [RecoLabs/gnata](https://github.com/RecoLabs/gnata), a JSONata 2.x engine in pure Go. This project extends it with a SQLite extension, query planner, TinyGo WASM LSP, CodeMirror editor, and composable React package.
0 commit comments