aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-13 06:59:18 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-13 06:59:52 +0100
commit7bb206831b37dde7a0f3208f445c8e645cc36a18 (patch)
treefd9cd99615c12255a25330c012e190f36f6e9664 /README.md
parent0c86cb5623df1053d302175505ad834a623ed0a4 (diff)
add `serve` command
Diffstat (limited to 'README.md')
-rw-r--r--README.md59
1 files changed, 32 insertions, 27 deletions
diff --git a/README.md b/README.md
index c9eba83..07ca11d 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,38 @@
-```console
-❯ tree data/
-data/
-├── c
-│   ├── 1.json
-│   └── 2.json
-└── j
- ├── 1.json
- └── 2.json
-```
+# astore
-```console
-> SELECT . FROM c
-{"id":2,"j_id":3}
-{"foo":"bar","id":1,"j_id":1}
+astore is a simple library and CLI program to query and manipulate a file hierarchy of JSON files.
-> SELECT id FROM c
-{"c.id":2}
-{"c.id":1}
+## Commands
-> SELECT c.id, j.id, is_j FROM c LEFT JOIN j ON j.id == c.j_id
-{"c.id":2,"is_j":null,"j.id":null}
-{"c.id":1,"is_j":true,"j.id":1}
+### `astore repl`
-> SELECT c.id, j.id FROM c RIGHT JOIN j ON j.id == c.j_id
-{"c.id":null,"j.id":2}
-{"c.id":1,"j.id":1}
+```console
+$ cabal run astore -- repl
+>>> SELECT * FROM c
+{"foo":"bar","id":1,"j_id":1}
+{"id":2,"j_id":3}
+>>> SELECT * FROM j
+{"id":1,"is_j":true}
+{"id":2,"is_j":true}
+>>> SELECT c.id, j.id, is_j FROM c LEFT JOIN j ON j.id == c.j_id
+{"c":{"id":1},"is_j":true,"j":{"id":1}}
+{"c":{"id":2},"is_j":null,"j":{"id":null}}
+>>> SELECT c.id, j.id FROM c RIGHT JOIN j ON j.id == c.j_id
+{"c":{"id":1},"j":{"id":1}}
+{"c":{"id":null},"j":{"id":2}}
+>>> SELECT c.id, j.id FROM c FULL JOIN j ON j.id == c.j_id
+{"c":{"id":1},"j":{"id":1}}
+{"c":{"id":2},"j":{"id":null}}
+{"c":{"id":null},"j":{"id":2}}
+>>> SELECT c, j FROM c EMBED j ON j.id == c.j_id
+{"c":null,"j":[{"id":1,"is_j":true}]}
+{"c":null,"j":[]}
+```
-> SELECT c.id, j.id FROM c FULL JOIN j ON j.id == c.j_id
-{"c.id":2,"j.id":null}
-{"c.id":1,"j.id":1}
-{"c.id":null,"j.id":2}
+### `astore serve`
+
+```console
+$ cabal run astore -- serve &
+$ curl -d 'SELECT * FROM c' http://localhost:8080
+[{"foo":"bar","id":1,"j_id":1},{"id":2,"j_id":3}]
```