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

Create a QueryBuilder from Map/Query WITH arguments #2494

Closed
cemoktra opened this issue May 10, 2023 · 0 comments
Closed

Create a QueryBuilder from Map/Query WITH arguments #2494

cemoktra opened this issue May 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@cemoktra
Copy link
Contributor

cemoktra commented May 10, 2023

Is your feature request related to a problem? Please describe.
I want to have a checked base query, that may contain bound areguments already, and based on that base query i would like to dynamically add WHERE clauses using the query builder.

Describe the solution you'd like
Add a with_arguments constructor to QueryBuilder or a From<Map<...>> for QueryBuilder implementation that keeps the arguments.

Describe alternatives you've considered
Rebinding the previously bound values afterwards but the problem with that approach is, that the initial bind got formatted to $1 and the first dynamic bind also gets bound to $1. As those are different types i get problems

@cemoktra cemoktra added the enhancement New feature or request label May 10, 2023
cemoktra pushed a commit to cemoktra/sqlx that referenced this issue May 19, 2023
cemoktra pushed a commit to cemoktra/sqlx that referenced this issue Jun 23, 2023
abonander added a commit that referenced this issue Jun 30, 2023
* add args to query builder (#2494)

* add test

* Update sqlx-core/src/query_builder.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* fmt

---------

Co-authored-by: Bastian Schubert <bastian.schubert@dock.financial>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
@cemoktra cemoktra closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant