add Span and PropertyMetadata structs

This commit is contained in:
pedrocarlo
2025-10-18 12:13:49 -03:00
parent a4f0f2364d
commit 2fe39d40bb

View File

@@ -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,