pub struct TableMetadata {
pub name: String,
pub comment: Option<String>,
pub columns: Vec<ColumnMetadata>,
pub indexes: Vec<IndexMetadata>,
pub foreign_keys: Vec<ForeignKeyMetadata>,
pub primary_key: Option<PrimaryKey>,
}Expand description
Metadata for a database table
Fields§
§name: StringTable name
comment: Option<String>Table comment (if any)
columns: Vec<ColumnMetadata>Columns in the table
indexes: Vec<IndexMetadata>Indexes (excluding primary key)
foreign_keys: Vec<ForeignKeyMetadata>Foreign key constraints
primary_key: Option<PrimaryKey>Primary key (if any)
Implementations§
Source§impl TableMetadata
impl TableMetadata
Sourcepub fn get_column(&self, name: &str) -> Option<&ColumnMetadata>
pub fn get_column(&self, name: &str) -> Option<&ColumnMetadata>
Get a column by name
Sourcepub fn get_indexed_columns(&self) -> Vec<&str>
pub fn get_indexed_columns(&self) -> Vec<&str>
Get all indexed columns (single-column indexes only)
Sourcepub fn is_primary_key_column(&self, column_name: &str) -> bool
pub fn is_primary_key_column(&self, column_name: &str) -> bool
Check if a column is part of the primary key
Trait Implementations§
Source§impl Clone for TableMetadata
impl Clone for TableMetadata
Source§fn clone(&self) -> TableMetadata
fn clone(&self) -> TableMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableMetadata
impl Debug for TableMetadata
Source§impl<'de> Deserialize<'de> for TableMetadata
impl<'de> Deserialize<'de> for TableMetadata
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
Auto Trait Implementations§
impl Freeze for TableMetadata
impl RefUnwindSafe for TableMetadata
impl Send for TableMetadata
impl Sync for TableMetadata
impl Unpin for TableMetadata
impl UnsafeUnpin for TableMetadata
impl UnwindSafe for TableMetadata
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