rel8
rel8 copied to clipboard
User docs not updated for #94
Looking at https://rel8.readthedocs.io/en/latest/tutorial.html#writing-queries I see it still says
>>> Right conn <- acquire "user=postgres"
>>> :t select conn (each projectSchema)
select conn (each projectSchema) :: MonadIO m => m [Project Result]
but as far as I can tell this is no-longer valid for version 1.1 thanks to #94
For those of us just trying things out quickly - aka have not used Hasql` before - what should this example be now?
Thanks, this does indeed need updating. The most comprehensive solution would be to use hasql-transaction. Then it would be something like:
import Hasql.Transaction (statement)
import Hasql.Transaction.Sessions (transaction, Mode(Write), IsolationLevel(ReadCommited))
import Hasql.Connection (acquire)
import Hasql.Session (run)
Right conn <- acquire "user=postgres"
run session conn
where
session = transaction ReadCommitted Write do
statement () $ select (each projectSchema)
Ta - that seems to work - I'll see if I can come up with a PR for the docs. Or at least a start for the docs.
That would be fantastic - thank you!
Unfortunately, this just bit us, as well.
@dhess Thanks for the ping, I'll see if I can get this updated soon. The cookbook is a little half baked, if you'll excuse the pun!
Just got this too, luckily I found this, but I was immensely confused for a bit there as types were not at all what the docs say they should be :sweat_smile:
I ran into the same today. It was fortunate that the very recent https://github.com/Zelenya/elephants provided me with enough example code to get me started :smile:
This is a very nice looking library!