pub fn nested_create(
    graph: &mut QueryGraph,
    parent_node: NodeRef,
    parent_relation_field: &RelationFieldRef,
    value: ParsedInputValue,
    child_model: &ModelRef,
) -> QueryGraphBuilderResult<()> {
    let relation = parent_relation_field.relation();

    // Build all create nodes upfront.
    let creates: Vec<NodeRef> = utils::coerce_vec(value)
        .into_iter()
        .map(|value| create::create_record_node(graph, Arc::clone(child_model), value.try_into()?))
        .collect::<QueryGraphBuilderResult<Vec<NodeRef>>>()?;

    if relation.is_many_to_many() {
        handle_many_to_many(graph, parent_node, parent_relation_field, creates)?;
    } else if relation.is_one_to_many() {
        handle_one_to_many(graph, parent_node, parent_relation_field, creates)?;
    } else {
        handle_one_to_one(graph, parent_node, parent_relation_field, creates)?;
    }

    Ok(())
}
/// Handles nested create one cases.
/// The resulting graph can take multiple forms, based on the relation type to the parent model.
/// Information on the graph shapes can be found on the individual handlers.
Handles nested create one cases.
The resulting graph can take multiple forms, based on the relation type to the parent model.
Information on the graph shapes can be found on the individual handlers.
Handles nested create one cases . The resulting graph can take multiple forms based on the relation type to the parent model . Information on the graph shapes can be found on the individual handlers .
pub fn nested_create(
    graph: &mut QueryGraph,
    parent_node: NodeRef,
    parent_relation_field: &RelationFieldRef,
    value: ParsedInputValue,
    child_model: &ModelRef,
) -> QueryGraphBuilderResult<()> {
    let relation = parent_relation_field.relation();
    // Build all create nodes upfront.
    let creates: Vec<NodeRef> = utils::coerce_vec(value)
        .into_iter()
        .map(|value| create::create_record_node(graph, Arc::clone(child_model), value.try_into()?))
        .collect::<QueryGraphBuilderResult<Vec<NodeRef>>>()?;
    if relation.is_many_to_many() {
        handle_many_to_many(graph, parent_node, parent_relation_field, creates)?;
    } else if relation.is_one_to_many() {
        handle_one_to_many(graph, parent_node, parent_relation_field, creates)?;
    } else {
        handle_one_to_one(graph, parent_node, parent_relation_field, creates)?;
    }
    Ok(())
}
pub fn nested_create ( graph : & mut QueryGraph , parent_node : NodeRef , parent_relation_field : & RelationFieldRef , value : ParsedInputValue , child_model : & ModelRef , ) -> QueryGraphBuilderResult < ( ) > { let relation = parent_relation_field . relation ( ) ; // Build all create nodes upfront. let creates : Vec < NodeRef > = utils :: coerce_vec ( value ) . into_iter ( ) . map ( | value | create :: create_record_node ( graph , Arc :: clone ( child_model ) , value . try_into ( ) ? ) ) . collect :: < QueryGraphBuilderResult < Vec < NodeRef > > > ( ) ? ; if relation . is_many_to_many ( ) { handle_many_to_many ( graph , parent_node , parent_relation_field , creates ) ? ; } else if relation . is_one_to_many ( ) { handle_one_to_many ( graph , parent_node , parent_relation_field , creates ) ? ; } else { handle_one_to_one ( graph , parent_node , parent_relation_field , creates ) ? ; } Ok ( ( ) ) }
Handles nested create one cases.
Handles nested create one cases .
graph
&mut QueryGraph
parent_node
NodeRef
parent_relation_field
&RelationFieldRef
value
ParsedInputValue
child_model
&ModelRef
graph
&mut QueryGraph
parent_node
NodeRef
parent_relation_field
&RelationFieldRef
value
ParsedInputValue
child_model
&ModelRef