pub struct TableDef {
pub name: String,
pub columns: Vec<ColumnDef>,
pub indices: Vec<IndexDef>,
pub description: Option<String>,
}Expand description
Definition of a single table.
Fields§
§name: String§columns: Vec<ColumnDef>§indices: Vec<IndexDef>§description: Option<String>Short description of the table’s purpose (emitted as SQL comment).
Implementations§
Source§impl TableDef
impl TableDef
pub fn new(name: &str) -> Self
pub fn description(self, desc: &str) -> Self
pub fn column(self, col: ColumnDef) -> Self
pub fn index(self, idx: IndexDef) -> Self
Sourcepub fn dependencies(&self) -> Vec<&str>
pub fn dependencies(&self) -> Vec<&str>
Get the names of tables this table depends on (via foreign keys).
Sourcepub fn apply_prefix(&mut self, old_prefix: &str, new_prefix: &str)
pub fn apply_prefix(&mut self, old_prefix: &str, new_prefix: &str)
Replace old_prefix with new_prefix in the table name and all FK references.
Trait Implementations§
impl Eq for TableDef
impl StructuralPartialEq for TableDef
Auto Trait Implementations§
impl Freeze for TableDef
impl RefUnwindSafe for TableDef
impl Send for TableDef
impl Sync for TableDef
impl Unpin for TableDef
impl UnsafeUnpin for TableDef
impl UnwindSafe for TableDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.