Struct SourceSchema
pub struct SourceSchema {
pub columns: Vec<Box<str>>,
pub column_types: Vec<ValueType>,
pub primary_key: Vec<usize>,
pub sort: Vec<(usize, bool)>,
}Expand description
Static, user-declared source table metadata: columns, primary key, and the
table’s default sort. This is the table-registration boundary type — what
Graph::add_source and the builder’s
resolve callback speak.
It deliberately carries no relationships and no singular: a relationship
is a property of a query (the explicit sub/EXISTS correlation in the AST),
not of a source table, and the engine derives the per-query relationship slots
from the AST at build time (see
query_local_slot_names). The type
makes it impossible to declare one on a source. Widen to a Schema (empty
relationships, singular = false) via From/SourceSchema::into_schema
when an operator needs the richer view/pipeline shape; the build path then
installs the query-derived slots over the empty relationships.
Fields§
§columns: Vec<Box<str>>Column names, in order (positional against source rows).
column_types: Vec<ValueType>Declared logical column types, parallel to columns (design 226 §4.1).
SourceSchema::new defaults every column to ValueType::Number; the
homes that know the real declared types (the replica’s decltype discovery,
the SQLite leaf) install them via SourceSchema::with_column_types.
primary_key: Vec<usize>Primary-key column indices (into columns).
sort: Vec<(usize, bool)>The table’s default sort — (col_idx, ascending) pairs.
Implementations§
§impl SourceSchema
impl SourceSchema
pub fn new(
columns: Vec<&str>,
primary_key: Vec<usize>,
sort: Vec<(usize, bool)>,
) -> SourceSchema
pub fn new( columns: Vec<&str>, primary_key: Vec<usize>, sort: Vec<(usize, bool)>, ) -> SourceSchema
Construct a source schema. Same call shape as Schema::new, so existing
Schema::new(vec!["id", …], …) source fixtures port over by renaming.
pub fn with_column_types(self, column_types: Vec<ValueType>) -> SourceSchema
pub fn with_column_types(self, column_types: Vec<ValueType>) -> SourceSchema
Builder: install the declared column types (parallel to columns, design
226 §4.1), replacing SourceSchema::new’s all-Number default.
pub fn col_id(&self, name: &str) -> Option<usize>
pub fn col_id(&self, name: &str) -> Option<usize>
Resolve a column name to its ColId. None if not present.
pub fn into_schema(self) -> Schema
pub fn into_schema(self) -> Schema
Widen to a Schema with no relationships and singular = false — the
view/pipeline shape an operator sees. Moves the columns/key/sort (no clone);
the build path replaces relationships with the query-derived slot tree.
Trait Implementations§
§impl Clone for SourceSchema
impl Clone for SourceSchema
§fn clone(&self) -> SourceSchema
fn clone(&self) -> SourceSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more