Skip to main content

uqa_execution/mutation/
events.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! The AFTER row events a command queues as it stages its rows.
8
9use uqa_core::DocId;
10use uqa_storage::document_store::Document;
11
12/// The AFTER row events of one command, in the order it staged its rows.
13#[derive(Default)]
14pub struct MutationEventQueue {
15    after_rows: Vec<crate::mutation::triggers::AfterRowTriggerEvent>,
16}
17
18impl MutationEventQueue {
19    pub fn after_rows(&self) -> &[crate::mutation::triggers::AfterRowTriggerEvent] {
20        &self.after_rows
21    }
22
23    pub fn after_rows_mut(&mut self) -> &mut Vec<crate::mutation::triggers::AfterRowTriggerEvent> {
24        &mut self.after_rows
25    }
26
27    pub fn append_after_rows(
28        &mut self,
29        events: Vec<crate::mutation::triggers::AfterRowTriggerEvent>,
30    ) {
31        self.after_rows.extend(events);
32    }
33
34    pub fn into_after_rows(self) -> Vec<crate::mutation::triggers::AfterRowTriggerEvent> {
35        self.after_rows
36    }
37}
38
39pub struct ReferentialRewritePreparation<'a> {
40    /// The table of the foreign key whose action rewrites the row.
41    pub constraint_table: &'a str,
42    pub table: &'a str,
43    pub doc_id: DocId,
44    pub old_document: Document,
45    pub proposed_document: Document,
46    pub updated_columns: Vec<String>,
47}