2

Let's say I have a parent::Entity with zero or many good_child::Entity, neutral_child::Entity, and evil_child::Entity. (Just an example. The actual child_* tables have nothing in common with one another).

Each child has a field with its parent's id. Now I can select all good_children for some parent with

let (parent, good_children) = model::parent::Entity::find_by_id(42)
    .find_with_related(model::good_child::Entity)
    .all(&db.begin().await.map_err(…)?)
    .await
    .map_err(…)?
    .pop()
    .ok_or(…)?;

But how can I get the neutral and evil children in the same query? Simply adding another find_with_related() call does not work:

no method named find_with_related found for struct SelectTwoMany in the current scope

method not found in SelectTwoMany<…::parent::Entity, projektdb_model::good_child::Entity>

Kijewski
  • 25,517
  • 12
  • 101
  • 143

0 Answers0