pub struct TableSchema {
pub name: String,
pub id: TableId,
pub columns: Vec<Column>,
pub primary_key: Vec<ColumnId>,
pub foreign_keys: Vec<ForeignKey>,
pub create_statement: Option<String>,
}Expand description
Complete table schema definition
Fields§
§name: StringTable name
id: TableIdTable ID within the schema
columns: Vec<Column>Column definitions in order
primary_key: Vec<ColumnId>Primary key column IDs (ordered for composite PKs)
foreign_keys: Vec<ForeignKey>Foreign key constraints
create_statement: Option<String>Raw CREATE TABLE statement (for output)
Implementations§
Source§impl TableSchema
impl TableSchema
Sourcepub fn get_column(&self, name: &str) -> Option<&Column>
pub fn get_column(&self, name: &str) -> Option<&Column>
Get a column by name
Sourcepub fn get_column_id(&self, name: &str) -> Option<ColumnId>
pub fn get_column_id(&self, name: &str) -> Option<ColumnId>
Get column ID by name
Sourcepub fn is_pk_column(&self, col_id: ColumnId) -> bool
pub fn is_pk_column(&self, col_id: ColumnId) -> bool
Check if column is part of the primary key
Sourcepub fn fk_column_ids(&self) -> Vec<ColumnId>
pub fn fk_column_ids(&self) -> Vec<ColumnId>
Get all FK column IDs (columns that reference other tables)
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
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 moreAuto Trait Implementations§
impl Freeze for TableSchema
impl RefUnwindSafe for TableSchema
impl Send for TableSchema
impl Sync for TableSchema
impl Unpin for TableSchema
impl UnwindSafe for TableSchema
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