pub struct Table {
pub id: TableId,
pub name: String,
pub columns: IndexMap<ColumnId, Column>,
pub constraints: IndexMap<ConstraintId, Constraint>,
pub comment: String,
}Expand description
A relational table.
Fields§
§id: TableIdUnique handle within the owning model.
name: StringTable name.
columns: IndexMap<ColumnId, Column>Columns, in author order.
constraints: IndexMap<ConstraintId, Constraint>Constraints attached to this table (PK, UNIQUE, FK, CHECK).
comment: StringOptional descriptive comment.
Implementations§
Source§impl Table
impl Table
Sourcepub fn columns_iter(&self) -> impl Iterator<Item = &Column>
pub fn columns_iter(&self) -> impl Iterator<Item = &Column>
Iterate the columns in author order.
Sourcepub fn primary_key(&self) -> Option<&Constraint>
pub fn primary_key(&self) -> Option<&Constraint>
Find the table’s primary-key constraint, if any.
Sourcepub fn primary_key_columns(&self) -> &[ColumnId]
pub fn primary_key_columns(&self) -> &[ColumnId]
IDs of the columns that compose the primary key. Empty if there is no PK or the PK is empty.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Table
impl<'de> Deserialize<'de> for Table
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Table
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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