Replies: 1 comment 2 replies
-
|
Right now For deeper Example idea: let rows = my_model::Entity::load()
.with(entity_b::Entity)
.all(db)
.await?;Then collect the loaded let b_ids: Vec<_> = rows
.iter()
.filter_map(|row| row.entity_b.as_ref().map(|b| b.id))
.collect();
let c_rows = entity_b::Entity::load()
.filter(entity_b::Column::Id.is_in(b_ids))
.with(entity_c::Entity)
.all(db)
.await?;Not as nice as: .with((entity_b, (entity_c, (entity_d, entity_e))))but it keeps the query/result shape explicit and avoids hidden huge joins. So imo nested For now I’d either:
Would also be useful to have this documented, because the expected syntax is pretty intuitive. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have more entities with chained OneToOne relations, if I do
my_model::Entity::load().with(...)only the 1st level of nested relations are loaded. Is there a way to load all of them using the seaorm 2.0?All the models have simple OneToOne relations using
#[sea_orm::model],#[sea_orm(has_one)]#[sea_orm(belongs_to, .......)Intuitively I expect to have something like:
Beta Was this translation helpful? Give feedback.
All reactions