pub enum SchemaBinding {
Table,
Column {
column: String,
requirement: ColumnRequirement,
},
}Expand description
Structural dependencies a piece of knowledge requires from the database schema.
A fact depends only on what it actually uses:
- Table-level knowledge (
TableDescription,TableAlias,TableGrain) depends only on the table existing. - Column-scoped knowledge (
ColumnDescription,ColumnRole,TableDefaultTime) depends on the specific named column existing and optionally satisfying a semantic type constraint (ColumnRequirement).
Variants§
Table
Depends only on the table existing in the schema.
Column
Depends on a named column existing and satisfying requirement.
Implementations§
Source§impl SchemaBinding
impl SchemaBinding
Sourcepub fn derive(slot: &KnowledgeSlot, payload: &ClaimPayload) -> Option<Self>
pub fn derive(slot: &KnowledgeSlot, payload: &ClaimPayload) -> Option<Self>
Derives the structural schema binding for a paired (KnowledgeSlot, ClaimPayload).
Table-level slots (TableDescription, TableAlias, TableGrain) yield
SchemaBinding::Table.
Column-level slots yield SchemaBinding::Column with appropriate semantic
ColumnRequirement:
TableDefaultTimeandColumnRole::TimestamprequireColumnRequirement::Time.ColumnRole::MeasurerequiresColumnRequirement::Numeric.ColumnDescriptionand otherColumnRolevariants requireColumnRequirement::Exists.
Returns None if the slot and payload types disagree, if column names mismatch,
or if the payload is not slot-bound (e.g. ClaimPayload::Relationship).
Sourcepub fn validate(&self, table: &Table) -> BindingValidity
pub fn validate(&self, table: &Table) -> BindingValidity
Validates this binding against a live table definition.
Evaluates whether the referenced table and column dependencies are satisfied. Matching column names is case-insensitive to align with SQL catalog conventions across database dialects.
Sourcepub fn validate_in_tree(
&self,
tree: &SchemaTree,
catalog: &str,
schema: &str,
table: &str,
) -> BindingValidity
pub fn validate_in_tree( &self, tree: &SchemaTree, catalog: &str, schema: &str, table: &str, ) -> BindingValidity
Validates this binding against a table found inside a SchemaTree.
Looks up the table at (catalog, schema, table) using case-insensitive
resolution via SchemaTree::find_table. If found, validates against
that live table; if not found, returns BindingValidity::Invalid.
Trait Implementations§
Source§impl Clone for SchemaBinding
impl Clone for SchemaBinding
Source§fn clone(&self) -> SchemaBinding
fn clone(&self) -> SchemaBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more