Rindle docs and package mapSkip to main content

SourceSchema

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

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

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>

Resolve a column name to its ColId. None if not present.

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

§

fn clone(&self) -> SourceSchema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SourceSchema

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<SourceSchema> for Schema

§

fn from(s: SourceSchema) -> Schema

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.