-
-
Notifications
You must be signed in to change notification settings - Fork 487
better api for passing parameters to *_raw
methods
#684
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
Conversation
this make impossible to use On a second though maybe not but query_raw API is strange I need to send a concrete implementation and then the function transform it to |
no I confirm this make the api way more limited to use here a small example of what I try: let params: &[&(dyn ToSql)] = &[&last_one, &(MAX as i64)];
client
.query_raw(&statement, params)
.await
.context(PostgreSQLError)? I explicitly add the type cause that wasn't compiling, now here the error:
|
in the end I need to not use |
is there any actual test that prove this can be used with |
seem this is what is needed: let params: [&dyn ToSql; 2] = [&last_one, &(MAX as i64)];
client
.query_raw(&statement, params)
.await
.context(PostgreSQLError)? my real problem seem to be unrelated to this, nevermind I need to dig more. |
still doesn't work I run into |
I end up copied rust-postgres/tokio-postgres/src/lib.rs Line 248 in ff7d88f
|
This enables passing iterators of
&dyn ToSql
orT: ToSql
as theparams
argument to*_raw
methods.Adds the a helper trait
BorrowToSql
that is only implemented for both&dyn ToSql
andT: ToSql
. This trait shouldn't be implemented by users.Maybe there's a better name for the trait, I chose it because I works as
Borrow<dyn ToSql>
if that was possible.Fixes #683