Skip to main content

uqa_execution/mutation/
row_images.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Typed old and new row images shared by mutation RETURNING and event paths.
8
9use crate::OwnedPhysicalRow;
10use uqa_core::DocId;
11use uqa_storage::{document_store::Document, DocumentMetadata};
12
13#[derive(Clone)]
14pub struct OwnedMutationImages {
15    pub old_storage_table: Option<String>,
16    pub old_doc_id: Option<DocId>,
17    pub old: Option<Document>,
18    pub new_storage_table: Option<String>,
19    pub new_doc_id: Option<DocId>,
20    pub new: Option<Document>,
21    pub context: Option<OwnedPhysicalRow>,
22}
23
24impl OwnedMutationImages {
25    pub fn empty() -> Self {
26        Self {
27            old_storage_table: None,
28            old_doc_id: None,
29            old: None,
30            new_storage_table: None,
31            new_doc_id: None,
32            new: None,
33            context: None,
34        }
35    }
36}
37
38#[derive(Clone)]
39pub struct MutationRowImage<'a> {
40    pub storage_table: String,
41    pub doc_id: DocId,
42    pub document: &'a Document,
43    pub metadata: DocumentMetadata,
44}
45
46#[derive(Clone)]
47pub struct MutationRowImages<'a> {
48    pub old: Option<MutationRowImage<'a>>,
49    pub new: Option<MutationRowImage<'a>>,
50}
51
52mod buffer;
53pub use buffer::{MutationImageBuffer, MutationImages};