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

hasql API integration #26

Open
avanov opened this issue Dec 13, 2021 · 2 comments
Open

hasql API integration #26

avanov opened this issue Dec 13, 2021 · 2 comments

Comments

@avanov
Copy link

avanov commented Dec 13, 2021

Hi!

I see that the current version of the project already depends on postgresql-binary, and I wonder to what extent it could integrate with hasql Connections and Sessions. As my projects already use hasql, I'd like to extend the existing API rather than replace it.
Ideally I see it as something like hasql-th but implemented as postgresql-typed under the hood.

@dylex
Copy link
Owner

dylex commented Jan 6, 2022

I've been thinking about this but it's a little tricky. hasql uses postgresql-libpq, the binding to postgres's client libpq library to talk to postgres, while postgresql-typed talks the postgresql protocol directly, because some of the query details were not available through libpq. It looks like they may be now, though using them might be a bit cumbersome. Regardless, it would take a significant rewrite to switch to the higher-level interface rather than the direct protocol (essentially switching out the Protocol module). It might be possible to do this in a partial way, using postgresql-typed's raw protocol for the TH-compile-time queries, and generating hasql-compatible run-time queries, but even that would take some work. I could point you in the right direction to try to do some of this, but I'm not sure I'm up for it at the moment.

@avanov
Copy link
Author

avanov commented Jan 7, 2022

Hi @dylex! I've linked a relevant hasql ticket that points to a dev-version Postgres protocol implementation in hasql. Maybe you could share a bit of information regarding GC handling?

It might be possible to do this in a partial way, using postgresql-typed's raw protocol for the TH-compile-time queries, and generating hasql-compatible run-time queries, but even that would take some work. I could point you in the right direction to try to do some of this, but I'm not sure I'm up for it at the moment.

I'd appreciate any guideline.

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

No branches or pull requests

2 participants