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

Consider using named parameters in queries #118

Closed
vrom911 opened this issue Jul 11, 2019 · 4 comments · Fixed by #128
Closed

Consider using named parameters in queries #118

vrom911 opened this issue Jul 11, 2019 · 4 comments · Fixed by #128
Labels
backend Haskell backend db Database queries, requests, issues
Projects

Comments

@vrom911
Copy link
Member

vrom911 commented Jul 11, 2019

We can use postgresql-simple-named library for this.

@vrom911 vrom911 added db Database queries, requests, issues backend Haskell backend labels Jul 11, 2019
@vrom911 vrom911 added this to the Tech Debt: No issues wanted milestone Jul 11, 2019
@vrom911 vrom911 added this to Next week in GSoC 2019 via automation Jul 11, 2019
@rashadg1030
Copy link
Collaborator

@vrom911 This is really cool. I agree we should introduce this.

@rashadg1030
Copy link
Collaborator

I was trying to look for an example, but can this be used with executeMany?

@chshersh
Copy link
Contributor

chshersh commented Jul 13, 2019

@rashadg1030 We don't have executeMany implemented in postgresql-simple-named library... I've created an issue about that:

But you still can use named parameters in other functions that don't use executeMany.

@rashadg1030 rashadg1030 moved this from Next week to This week in GSoC 2019 Jul 14, 2019
@chshersh
Copy link
Contributor

I think that this issue is also unblocked. We can start using named parameters right now to avoid migration to this way later when there are more functions to refactor. So every SQL query that is not used under executeMany can be moved to use queryNamed or executeNamed. You can check three-layer to see how to perform this migration (it's not straightforward because you need to deal with MonadError parametrised by different types but possible).

GSoC 2019 automation moved this from This week to Done Jul 21, 2019
chshersh pushed a commit that referenced this issue Jul 21, 2019
* [#118] Introduce queryNamed and executeNamed database functions

Resolves #118

* [#118] Refactor database functions to use queryNamed and executeNamed

Resolves #118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Haskell backend db Database queries, requests, issues
Projects
GSoC 2019
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants