diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-13 07:50:30 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-02-13 07:50:30 +0100 |
commit | 748f82632e5ab6fc2c2f7a6eedb1ac4c467ccb3e (patch) | |
tree | 17467887fd046caf8ca68593a02156489264d39d /README.md | |
parent | 7bb206831b37dde7a0f3208f445c8e645cc36a18 (diff) |
explicitly construct objects in SELECT
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -8,31 +8,31 @@ astore is a simple library and CLI program to query and manipulate a file hierar ```console $ cabal run astore -- repl ->>> SELECT * FROM c +>>> SELECT c FROM c {"foo":"bar","id":1,"j_id":1} {"id":2,"j_id":3} ->>> SELECT * FROM j +>>> SELECT j 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 +>>> 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.id, j.id FROM c RIGHT JOIN j ON j.id == c.j_id +>>> 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.id, j.id FROM c FULL JOIN j ON j.id == c.j_id +>>> 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":null,"j":[{"id":1,"is_j":true}]} -{"c":null,"j":[]} +>>> 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` ```console $ cabal run astore -- serve & -$ curl -d 'SELECT * FROM c' http://localhost:8080 +$ curl -d 'SELECT c FROM c' http://localhost:8080 [{"foo":"bar","id":1,"j_id":1},{"id":2,"j_id":3}] ``` |