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
I have a struct defined as
#[derive(Debug, FromRow, Serialize)] pub struct Building { pub name: String, pub key: String, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<String>, }
and I want to make another where some other field is included (in this case conf):
#[derive(Debug, FromRow, Serialize)] pub struct BuildingWithConfig { #[sqlx(flatten)] pub building: Building, pub conf: JsonValue, }
In my mind this would work, but it doesn't:
error[E0560]: struct `structure::BuildingWithConfig` has no field named `key` --> src/routes/map.rs:96:5 | 96 | / sqlx::query_as!( 97 | | BuildingWithConfig, 98 | | r#" 99 | | SELECT ... | 110 | | is_preview 111 | | ) | |_____^ `structure::BuildingWithConfig` does not have this field | = note: available fields are: `conf`, `building`
Using this query:
SELECT b.name, b.description, b.key, c.configuration AS conf FROM buildings b JOIN component_configurations c ON c.id = 'page-building-' || b.key
rustc --version
The text was updated successfully, but these errors were encountered:
Hi! This is a duplicate of #2188. TL;DR: The query_as! macro does not use the FromRow implementation, though it might change in the future (#514).
query_as!
FromRow
Sorry, something went wrong.
No branches or pull requests
Bug Description
I have a struct defined as
and I want to make another where some other field is included (in this case conf):
In my mind this would work, but it doesn't:
Using this query:
Info
"runtime-tokio-rustls",
"macros",
"postgres",
"migrate",
"offline",
"time",
"chrono",
"json",
]
rustc --version
: 1.70The text was updated successfully, but these errors were encountered: