-
|
I'm failing to implement FromQueryResult for a struct - I tried following the example in the docs: #[derive(FromQueryResult)]
struct Cake {
id: i32,
name: String,
#[sea_orm(nested)]
bakery: Option<Bakery>,
}
#[derive(FromQueryResult)]
struct Bakery {
#[sea_orm(from_alias = "bakery_id")]
id: i32,
#[sea_orm(from_alias = "bakery_name")]
brand: String,
}But not even that works: This old discussion suggests its not possible, but the docs show a clear example where it's supposed to work - what am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Our workaround: #[sea_orm(skip)]
bakery: Option<Bakery>, let cakes = Cake::find()
.find_also_related(Bakery)
// ...
.into_model::<Cake, Bakery>()
.all(db)
.await?
.into_iter()
.map(|(mut c, b)| {
c.bakery = b;
c
})
.collect(); |
Beta Was this translation helpful? Give feedback.
-
|
So, it turns out when I use the latest master branch (instead of I did run into some other problem: #2536 |
Beta Was this translation helpful? Give feedback.
So, it turns out when I use the latest master branch (instead of
1.1.7, it works :). So I guess it's a bug in 1.1.x 💁♂️I did run into some other problem: #2536