uqa_execution/mutation/entry/
context.rs1use crate::mutation::output::MutationOutput;
9use crate::mutation::{
10 statement::context::MutationStatementContext, views::commands::SourceOutputPruning,
11};
12use uqa_sql::{
13 routines::RoutineResolution,
14 semantics::{conflict::InferenceContext, returning::ReturningAnalysisContext},
15 SQLError,
16};
17
18pub trait MutationTargetResolution {
19 fn resolve_target(&self, name: &str, bound: bool) -> Result<String, SQLError>;
20}
21pub struct MutationCommandContext<'a, S: Clone + 'static> {
22 pub statement: MutationStatementContext<'a, S>,
23 pub inference: InferenceContext<'a>,
24 pub returning: ReturningAnalysisContext<'a>,
25 pub prune_source_outputs: SourceOutputPruning,
26}
27pub type MutationCommand<'a, S> =
28 Box<dyn FnOnce(&MutationCommandContext<'_, S>) -> Result<MutationOutput, SQLError> + 'a>;
29pub trait MutationCommandBoundary<S: Clone + 'static> {
30 fn with_command(&self, command: MutationCommand<'_, S>) -> Result<MutationOutput, SQLError>;
31}
32pub struct MutationEntryContext<'a, S: Clone + 'static> {
33 pub targets: &'a dyn MutationTargetResolution,
34 pub transactions: &'a dyn MutationCommandBoundary<S>,
35 pub routines: &'a dyn RoutineResolution,
36}