aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 07ca11dd386925c0de35f61c210ae056af5e1fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# astore

astore is a simple library and CLI program to query and manipulate a file hierarchy of JSON files.

## Commands

### `astore repl`

```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":[]}
```

### `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}]
```