astore
astore is a simple library and CLI program to query and manipulate a file hierarchy of JSON files.
Commands
astore repl
$ cabal run astore -- repl
>>> SELECT c FROM c
{"foo":"bar","id":1,"j_id":1}
{"id":2,"j_id":3}
>>> SELECT j FROM j
{"id":1,"is_j":true}
{"id":2,"is_j":true}
>>> SELECT { c: { c.id }, j.is_j, j: { j.id } } 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: { c.id }, j: { 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: { c.id }, j: { 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":{"foo":"bar","id":1,"j_id":1},"j":[{"id":1,"is_j":true}]}
{"c":{"id":2,"j_id":3},"j":[]}
astore serve
$ cabal run astore -- serve &
$ curl -d 'SELECT c FROM c' http://localhost:8080
[{"foo":"bar","id":1,"j_id":1},{"id":2,"j_id":3}]