Skip to main content

load_has_many

Function load_has_many 

Source
pub async fn load_has_many<E, P, C, R>(
    engine: &E,
    parents: &[P],
) -> QueryResult<HashMap<String, Vec<C>>>
where E: QueryEngine, P: Model + ModelWithPk, C: Model + ModelWithPk + FromRow + Send + 'static, R: RelationMeta<Owner = P, Target = C>,
Expand description

Fetch children for a HasMany (or HasOne) relation and bucket by the FK column value turned into a stable string key.

Returns an empty map when parents is empty — the caller must short-circuit before issuing the SELECT.