Hi,
first of all thank you for your work on this project. Watching the video and reading through the examples this seems like an amazing library to use.
Unfortunately I have had some issues when trying to follow https://rel8.readthedocs.io/en/latest/tutorial.html
TableSchema.schema does not exist anymore. This seems to be fixed in https://github.com/circuithub/rel8/blob/master/docs/tutorial.rst but not on readthedocs.io
- I had a very hard time figuring out how to actually run a Query, it took me multiple hours of hopping between hasql and rel8 documentation :( (Granted, I didn't have experience with either).
select conn (each projectSchema) does not work anymore
select (each projectSchema) gives me a Statement (Query (Project Expr)) so I tried to follow the types to see how this ever gets executed. hasql and rel8 both have a run function and a Statement type which makes it more confusing to figure out how to plumb things together.
For now, I ended up with this, but I have no idea if this is an idiomatic way of doing things:
allProjects :: Query (Project Expr)
allProjects = each projectSchema
runSelectAllProjects :: Hasql.Connection -> IO ()
runSelectAllProjects conn = do
let rel8Statement = select allProjects -- Statement (Query (Project Expr))
hasqlStatement = run rel8Statement -- Hasql.Statement () [Project Result]
hasqlSession = Hasql.statement () hasqlStatement -- Hasql.Session [Project Result]
resOrErr <- Hasql.run hasqlSession conn
case resOrErr of
Left sessErr -> error $ show sessErr
Right res -> mapM_ print res
(I've imported everything from Hasql qualified to make it obvious to me where things come from).
Hi,
first of all thank you for your work on this project. Watching the video and reading through the examples this seems like an amazing library to use.
Unfortunately I have had some issues when trying to follow https://rel8.readthedocs.io/en/latest/tutorial.html
TableSchema.schemadoes not exist anymore. This seems to be fixed in https://github.com/circuithub/rel8/blob/master/docs/tutorial.rst but not on readthedocs.ioselect conn (each projectSchema)does not work anymoreselect (each projectSchema)gives me aStatement (Query (Project Expr))so I tried to follow the types to see how this ever gets executed. hasql and rel8 both have arunfunction and aStatementtype which makes it more confusing to figure out how to plumb things together.For now, I ended up with this, but I have no idea if this is an idiomatic way of doing things:
(I've imported everything from Hasql qualified to make it obvious to me where things come from).