pub struct Schema {
pub tables: AHashMap<String, TableId>,
pub table_schemas: Vec<TableSchema>,
}Expand description
Complete database schema
Fields§
§tables: AHashMap<String, TableId>Map from table name to table ID
table_schemas: Vec<TableSchema>Table schemas indexed by TableId
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn get_table_id(&self, name: &str) -> Option<TableId>
pub fn get_table_id(&self, name: &str) -> Option<TableId>
Get table ID by name (case-insensitive)
Sourcepub fn table(&self, id: TableId) -> Option<&TableSchema>
pub fn table(&self, id: TableId) -> Option<&TableSchema>
Get table schema by ID
Sourcepub fn table_mut(&mut self, id: TableId) -> Option<&mut TableSchema>
pub fn table_mut(&mut self, id: TableId) -> Option<&mut TableSchema>
Get mutable table schema by ID
Sourcepub fn get_table(&self, name: &str) -> Option<&TableSchema>
pub fn get_table(&self, name: &str) -> Option<&TableSchema>
Get table schema by name
Sourcepub fn add_table(&mut self, schema: TableSchema) -> TableId
pub fn add_table(&mut self, schema: TableSchema) -> TableId
Add a new table schema, returning its ID
Sourcepub fn resolve_foreign_keys(&mut self)
pub fn resolve_foreign_keys(&mut self)
Resolve all foreign key references to table IDs
Sourcepub fn iter(&self) -> impl Iterator<Item = &TableSchema>
pub fn iter(&self) -> impl Iterator<Item = &TableSchema>
Iterate over all table schemas
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
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