pub struct TableDef {
pub name: String,
pub kind: TableKind,
pub columns: Vec<ColumnDef>,
pub primary_key: Vec<String>,
pub foreign_keys: Vec<ForeignKey>,
pub unique_keys: Vec<Vec<String>>,
}Expand description
One table or view.
Fields§
§name: StringThe unqualified name as the catalog spells it.
kind: TableKindTable or view.
columns: Vec<ColumnDef>Columns in catalog (ordinal) order — the order the generated model lists them, matching the hand-written spec.
primary_key: Vec<String>Primary-key column names in key order; empty when there is none (all
views, and keyless tables — both emit View-only models unless the
configuration declares a key, see [tables.<name>] key).
foreign_keys: Vec<ForeignKey>Foreign keys in a stable catalog order.
unique_keys: Vec<Vec<String>>Declared UNIQUE constraints, each a column list in key order,
sorted by column list; the primary key is not repeated here.
Read by the factory emitter, which backs a unique column with a
Sequence value so
create_many(&db, 100) cannot collide. Only declared constraints
are introspected — a bare CREATE UNIQUE INDEX is an index, not a
constraint, and is deliberately not read (the generator would have no
honest way to tell a partial or expression index from a plain one).
Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more