From 2fe39d40bb8ba4905e8ed040fe7c8335be8ea07c Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Sat, 18 Oct 2025 12:13:49 -0300 Subject: [PATCH] add Span and PropertyMetadata structs --- simulator/model/interactions.rs | 39 ++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/simulator/model/interactions.rs b/simulator/model/interactions.rs index 588cb0a29..ec03d0a45 100644 --- a/simulator/model/interactions.rs +++ b/simulator/model/interactions.rs @@ -12,7 +12,10 @@ use turso_core::{Connection, Result, StepResult}; use crate::{ generation::Shadow, - model::{Query, ResultSet, property::Property}, + model::{ + Query, ResultSet, + property::{Property, PropertyDiscriminants}, + }, runner::env::{ShadowTablesMut, SimConnection, SimulationType, SimulatorEnv}, }; @@ -495,6 +498,40 @@ impl Display for Fault { } } +#[derive(Debug, Clone, Copy)] +pub enum Span { + Start, + End, + // Both start and end + StartEnd, +} + +impl Span { + fn start(&self) -> bool { + matches!(self, Self::Start | Self::StartEnd) + } + + fn end(&self) -> bool { + matches!(self, Self::End | Self::StartEnd) + } +} + +#[derive(Debug, Clone, Copy)] +pub struct PropertyMetadata { + pub property: PropertyDiscriminants, + // If the query is an extension query + pub extension: bool, +} + +impl PropertyMetadata { + pub fn new(property: &Property, extension: bool) -> PropertyMetadata { + Self { + property: property.into(), + extension, + } + } +} + #[derive(Debug, Clone)] pub struct Interaction { pub connection_index: usize,