We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As an extension to #199, it would be nice if SQLx supported the following for databases compatible with named bindings:
query!("INSERT INTO foo (id, a, b, c) VALUES (:id, :a, :b, :c)", id=new_id, ..foo) // shorthand for query!( "INSERT INTO foo (id, a, b, c) VALUES (:id, :a, :b, :c)", id=new_id, a=foo.a, b=foo.b, c=foo.c, )
The text was updated successfully, but these errors were encountered:
I love this suggestion !
In the context of web APIs, I often end up with a struct containing all the request parameters, something like this:
struct NewUserParameters { email: String, password: String, // and many more fields }
Followed by some queries such as:
sqlx::query_as(concat!( "INSERT INTO users", " (email, password, etc..)", " VALUES ($1, $2, etc..)", " RETURNING *" )) .bind(new_user_parameters.email) .bind(new_user_parameters.password) // etc
The suggested syntax would greatly reduce repetitions:
sqlx::query_as!(concat!( "INSERT INTO users", " (email, password, etc..)", " VALUES (:email, :password, etc..)", " RETURNING *" ), ..new_user_parameters); // Done !
Sorry, something went wrong.
No branches or pull requests
As an extension to #199, it would be nice if SQLx supported the following for databases compatible with named bindings:
The text was updated successfully, but these errors were encountered: