Support multi-statement mutations (insert + edge in one query)

Allow mutation queries to contain multiple sequential statements that
execute atomically within a single transactional run. This enables
patterns like inserting a node and its edges in one query:

    query add_and_link($name: String, $age: I32, $friend: String) {
        insert Person { name: $name, age: $age }
        insert Knows { from: $name, to: $friend }
    }

Changes span the full compiler-to-execution pipeline:
- Grammar: mutation_body = { mutation_stmt+ }
- AST: QueryDecl.mutations: Vec<Mutation>
- IR: MutationIR.ops: Vec<MutationOpIR>
- Execution: loop over ops, accumulate affected counts

Cross-statement visibility works because each statement's commit_updates
advances the manifest state, so subsequent statements see prior writes.
Atomicity comes from the existing run mechanism (begin_run/publish_run).

https://claude.ai/code/session_01E4VG2WXrZW8aeXFiqr8NwF
This commit is contained in:
Claude 2026-04-11 20:27:51 +00:00
parent a844e0ba68
commit d10f78530f
No known key found for this signature in database
9 changed files with 240 additions and 64 deletions

View file

@ -15,7 +15,7 @@ pub struct QueryDecl {
pub return_clause: Vec<Projection>,
pub order_clause: Vec<Ordering>,
pub limit: Option<u64>,
pub mutation: Option<Mutation>,
pub mutations: Vec<Mutation>,
}
#[derive(Debug, Clone)]