pub struct DatabaseSchema {
pub tables: Vec<TableDefinition>,
/* private fields */
}Expand description
Database schema (collection of tables, no generators).
Used for schema introspection during incremental sync operations. Contains all table definitions collected from the source database.
Fields§
§tables: Vec<TableDefinition>Table definitions
Implementations§
Source§impl DatabaseSchema
impl DatabaseSchema
Sourcepub fn new(tables: Vec<TableDefinition>) -> Self
pub fn new(tables: Vec<TableDefinition>) -> Self
Create a new database schema from a list of table definitions.
Sourcepub fn get_table(&self, name: &str) -> Option<&TableDefinition>
pub fn get_table(&self, name: &str) -> Option<&TableDefinition>
Get a table schema by name.
Sourcepub fn get_table_mut(&mut self, name: &str) -> Option<&mut TableDefinition>
pub fn get_table_mut(&mut self, name: &str) -> Option<&mut TableDefinition>
Get a mutable table schema by name.
Sourcepub fn get_column_type(
&self,
table: &str,
column: &str,
) -> Result<&Type, SchemaError>
pub fn get_column_type( &self, table: &str, column: &str, ) -> Result<&Type, SchemaError>
Get the type of a column in a specific table.
Sourcepub fn table_names(&self) -> Vec<&str>
pub fn table_names(&self) -> Vec<&str>
Get all table names in the schema.
Sourcepub fn add_table(&mut self, table: TableDefinition)
pub fn add_table(&mut self, table: TableDefinition)
Add a table to the schema.
Trait Implementations§
Source§impl Clone for DatabaseSchema
impl Clone for DatabaseSchema
Source§fn clone(&self) -> DatabaseSchema
fn clone(&self) -> DatabaseSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DatabaseSchema
impl Debug for DatabaseSchema
Source§impl Default for DatabaseSchema
impl Default for DatabaseSchema
Source§fn default() -> DatabaseSchema
fn default() -> DatabaseSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DatabaseSchema
impl<'de> Deserialize<'de> for DatabaseSchema
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 DatabaseSchema
impl RefUnwindSafe for DatabaseSchema
impl Send for DatabaseSchema
impl Sync for DatabaseSchema
impl Unpin for DatabaseSchema
impl UnsafeUnpin for DatabaseSchema
impl UnwindSafe for DatabaseSchema
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