rel8 icon indicating copy to clipboard operation
rel8 copied to clipboard

User docs not updated for #94

Open DougBurke opened this issue 4 years ago • 7 comments

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?

DougBurke avatar Aug 23 '21 13:08 DougBurke

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)

ocharles avatar Aug 23 '21 14:08 ocharles

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.

DougBurke avatar Aug 23 '21 18:08 DougBurke

That would be fantastic - thank you!

ocharles avatar Aug 23 '21 19:08 ocharles

Unfortunately, this just bit us, as well.

dhess avatar Feb 01 '22 12:02 dhess

@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!

ocharles avatar Feb 01 '22 13:02 ocharles

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:

TheOddler avatar Aug 04 '23 13:08 TheOddler

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!

kodeFant avatar Nov 04 '23 21:11 kodeFant