pub struct Table {
pub name: Arc<str>,
pub columns: Vec<Column>,
pub source: Source,
pub cardinality: Cardinality,
pub element: Arc<str>,
}Fields§
§name: Arc<str>§columns: Vec<Column>§source: Source§cardinality: Cardinality§element: Arc<str>The Beck type one row stands for, for beck explain sql to print.
Implementations§
Source§impl Table
impl Table
pub fn column(&self, name: &str) -> Option<(usize, &Column)>
Sourcepub fn row_values(&self, v: &Value) -> Vec<Value>
pub fn row_values(&self, v: &Value) -> Vec<Value>
One value as one row’s worth of values, one per column.
This is the rule that says what a column is, and it is shared rather than restated:
Table::row builds a scan’s cells from it and crate::query normalises a table’s rows
with it before compiling them into a plan, so a select that scans and a select that
joins cannot disagree about which part of an element a column names.
Value::Unit stands for a field the value does not have, which becomes NULL in every
column type.
Sourcepub fn row(&self, v: &Value) -> Vec<Cell> ⓘ
pub fn row(&self, v: &Value) -> Vec<Cell> ⓘ
One value as one row, coerced to the columns this table declares.
Coerced rather than trusted: the column types come from the declared type and the value comes from a running program, so a value that does not fit its column becomes NULL rather than a wrongly-encoded field on the wire. Nothing in the corpus reaches that branch; the branch is there because “cannot happen” is not a wire format.