Struct spacetimedb_sats::relation::Header
source · pub struct Header {
pub table_name: String,
pub fields: Vec<Column>,
pub constraints: Vec<(ColList, Constraints)>,
}
Fields§
§table_name: String
§fields: Vec<Column>
§constraints: Vec<(ColList, Constraints)>
Implementations§
source§impl Header
impl Header
pub fn new( table_name: String, fields: Vec<Column>, constraints: Vec<(ColList, Constraints)> ) -> Self
pub fn from_product_type(table_name: String, fields: ProductType) -> Self
pub fn for_mem_table(fields: ProductType) -> Self
pub fn as_without_table_name(&self) -> HeaderOnlyField<'_>
pub fn ty(&self) -> ProductType
pub fn find_by_name(&self, field_name: &str) -> Option<&Column>
pub fn column_pos<'a>(&'a self, col: &'a FieldName) -> Option<ColId>
pub fn column_pos_or_err<'a>( &'a self, col: &'a FieldName ) -> Result<ColId, RelationError>
sourcepub fn find_pos_by_name(&self, name: &str) -> Option<ColId>
pub fn find_pos_by_name(&self, name: &str) -> Option<ColId>
Finds the position of a field with name
.
pub fn column<'a>(&'a self, col: &'a FieldName) -> Option<&Column>
pub fn has_constraint(&self, field: &FieldName, constraint: Constraints) -> bool
sourcepub fn project(
&self,
cols: &[impl Into<FieldExpr> + Clone]
) -> Result<Self, RelationError>
pub fn project( &self, cols: &[impl Into<FieldExpr> + Clone] ) -> Result<Self, RelationError>
Project the FieldExpr & the Constraints that referenced them
sourcepub fn extend(&self, right: &Self) -> Self
pub fn extend(&self, right: &Self) -> Self
Adds the fields & Constraints from right
to this Header
,
renaming duplicated fields with a counter like a, a => a, a0
.
Trait Implementations§
source§impl From<&TableSchema> for Header
impl From<&TableSchema> for Header
source§fn from(value: &TableSchema) -> Self
fn from(value: &TableSchema) -> Self
Converts to this type from the input type.
source§impl From<AlgebraicType> for Header
impl From<AlgebraicType> for Header
source§fn from(value: AlgebraicType) -> Self
fn from(value: AlgebraicType) -> Self
Converts to this type from the input type.
source§impl From<Header> for ProductType
impl From<Header> for ProductType
source§impl From<ProductType> for Header
impl From<ProductType> for Header
source§fn from(value: ProductType) -> Self
fn from(value: ProductType) -> Self
Converts to this type from the input type.
source§impl Ord for Header
impl Ord for Header
source§impl PartialEq for Header
impl PartialEq for Header
source§impl PartialOrd for Header
impl PartialOrd for Header
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more