How to get query! to pick up sqlx::Type/sqlx::Encode information
#4258
Replies: 1 comment 1 reply
|
Your For Postgres bind parameters, use the macro's supported type-override syntax: sqlx::query!(
"UPDATE project_files
SET content_hash = $3,
lamport_clock = $4,
deleted_at = NULL
WHERE project_id = $1 AND relative_path = $2",
project_id.as_ref(),
&key.relative_blob_name(),
key.as_ref() as _,
lamport_clock,
)
.execute(&mut *tx)
.await?;
An explicit override such as I verified this in SQLx 0.8.6's macro implementation and its PostgreSQL |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have a type which implements
TypeandEncodefor&[u8]withPostgres. When I go to try and compile,query!fails because I gave it my type, and not&[u8], but I had thought these trait impls where how you would get around that.All reactions