module Main ( main, ) where import Data.Aeson qualified as J import Data.ByteString.Lazy.Char8 qualified as LB import Store 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