blob: 7bf67ba419f1112e8ffb573d33b52bc300d8a28f (
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
|
module Main
( main,
)
where
import Data.Aeson qualified as J
import Data.ByteString.Lazy.Char8 qualified as LB
import Query qualified as Q
import System.Directory (setCurrentDirectory)
import Text.Printf (printf)
main :: IO ()
main = do
setCurrentDirectory "./data"
mapM_
( \q -> do
printf "> %s\n" (show q)
query' q
)
[ "SELECT * FROM c",
"SELECT * FROM j",
"SELECT c.id, j.id, is_j FROM c LEFT JOIN j ON j.id == c.j_id",
"SELECT c.id, j.id FROM c RIGHT JOIN j ON j.id == c.j_id",
"SELECT c.id, j.id FROM c FULL JOIN j ON j.id == c.j_id",
"SELECT c.id, j FROM c EMBED j ON j.id == c.j_id"
]
query' :: Q.Query -> IO ()
query' q = mapM_ (LB.putStrLn . J.encode) =<< Q.query q
|