pub enum SourceSpec {
Single(String),
Multi(Vec<String>),
Pattern(String),
}Expand description
Source-table specifier — either a single table, a list combined via
ATTACH DATABASE + UNION ALL (Crux #3), or a glob pattern that must
be resolved against the live TableRegistry before execution.
Variants§
Single(String)
One table by name (existing 1-table compatibility, used as the
normalisation target for any legacy callers that supplied a bare
table argument).
Multi(Vec<String>)
Two or more tables, joined via UNION ALL (never JOIN).
Pattern(String)
Glob pattern (e.g. "shi_*") resolved against the registry at
alias_run time. Callers MUST resolve to SourceSpec::Multi via
SourceSpec::resolve_pattern before invoking execute_aggregate;
SourceSpec::tables returns an empty slice for this variant so
the existing “empty sources” guard in execute_aggregate fires as a
fail-fast bug detector if resolution is skipped.
Implementations§
Source§impl SourceSpec
impl SourceSpec
Sourcepub fn tables(&self) -> &[String]
pub fn tables(&self) -> &[String]
Returns the source tables as a slice. Length is 1 for Single,
the supplied vector’s length for Multi, and 0 for Pattern
(unresolved — must be resolved via SourceSpec::resolve_pattern
before execute_aggregate). execute_aggregate rejects an
empty Multi (and consequently an unresolved Pattern) with
MiniAppError::Aggregator.
Sourcepub fn requires_resolve(&self) -> bool
pub fn requires_resolve(&self) -> bool
Returns true when this variant requires registry-side glob
resolution (i.e. SourceSpec::Pattern). Phase 2 alias_run
callers branch on this to invoke SourceSpec::resolve_pattern
before passing the spec to execute_aggregate.
Sourcepub fn includes_table(&self, table: &str) -> bool
pub fn includes_table(&self, table: &str) -> bool
Returns true when this source spec covers table — Single
when the names match, Multi when the list contains table,
Pattern when the glob compiles and matches table. Used by
alias_list({"table":"X"}) to keep Multi / Pattern aliases that
reference X visible (the older SourceSpec::Single-only
retain predicate silently dropped them).
Sourcepub fn resolve_pattern(
self,
all_tables: &[String],
) -> Result<Self, MiniAppError>
pub fn resolve_pattern( self, all_tables: &[String], ) -> Result<Self, MiniAppError>
Resolves SourceSpec::Pattern against the supplied table-name
list using a simple * glob (one segment, no ? / [] support
in Phase 2 — extension point reserved for a future revision).
Returns Single(name) when exactly one table matches, Multi(v)
when two or more match (sorted ascending for determinism), and
Err(MiniAppError::Aggregator) when zero tables match (so callers
surface the empty-sources error early rather than after ATTACH).
Non-Pattern variants are returned unchanged so callers can
invoke this unconditionally without branching on
SourceSpec::requires_resolve.
Trait Implementations§
Source§impl Clone for SourceSpec
impl Clone for SourceSpec
Source§fn clone(&self) -> SourceSpec
fn clone(&self) -> SourceSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceSpec
impl Debug for SourceSpec
Source§impl<'de> Deserialize<'de> for SourceSpec
impl<'de> Deserialize<'de> for SourceSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SourceSpec
impl JsonSchema for SourceSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more