Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User docs not updated for #94 #132

Open
DougBurke opened this issue Aug 23, 2021 · 7 comments
Open

User docs not updated for #94 #132

DougBurke opened this issue Aug 23, 2021 · 7 comments

Comments

@DougBurke
Copy link
Contributor

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?

@ocharles
Copy link
Contributor

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 ocharles changed the title User docs not updated for #94? User docs not updated for #94 Aug 23, 2021
@DougBurke
Copy link
Contributor Author

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.

@ocharles
Copy link
Contributor

That would be fantastic - thank you!

@dhess
Copy link

dhess commented Feb 1, 2022

Unfortunately, this just bit us, as well.

@ocharles
Copy link
Contributor

ocharles commented Feb 1, 2022

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

@TheOddler
Copy link

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 😅

@kodeFant
Copy link

kodeFant commented Nov 4, 2023

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 😄

This is a very nice looking library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants