pub enum TableConstraint {
Unique {
name: Option<Ident>,
columns: Vec<Ident>,
is_primary: bool,
},
ForeignKey {
name: Option<Ident>,
columns: Vec<Ident>,
foreign_table: ObjectName,
referred_columns: Vec<Ident>,
on_delete: Option<ReferentialAction>,
on_update: Option<ReferentialAction>,
},
Check {
name: Option<Ident>,
expr: Box<Expr>,
},
}
Expand description
A table-level constraint, specified in a CREATE TABLE
or an
ALTER TABLE ADD <constraint>
statement.
Variants§
Unique
[ CONSTRAINT <name> ] { PRIMARY KEY | UNIQUE } (<columns>)
Fields
ForeignKey
A referential integrity constraint ([ CONSTRAINT <name> ] FOREIGN KEY (<columns>) REFERENCES <foreign_table> (<referred_columns>) { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] }
).
Fields
§
foreign_table: ObjectName
§
on_delete: Option<ReferentialAction>
§
on_update: Option<ReferentialAction>
Check
[ CONSTRAINT <name> ] CHECK (<expr>)
Trait Implementations§
source§impl Clone for TableConstraint
impl Clone for TableConstraint
source§fn clone(&self) -> TableConstraint
fn clone(&self) -> TableConstraint
Returns a copy 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 moresource§impl Debug for TableConstraint
impl Debug for TableConstraint
source§impl Display for TableConstraint
impl Display for TableConstraint
source§impl Hash for TableConstraint
impl Hash for TableConstraint
source§impl PartialEq for TableConstraint
impl PartialEq for TableConstraint
impl Eq for TableConstraint
impl StructuralPartialEq for TableConstraint
Auto Trait Implementations§
impl Freeze for TableConstraint
impl RefUnwindSafe for TableConstraint
impl Send for TableConstraint
impl Sync for TableConstraint
impl Unpin for TableConstraint
impl UnwindSafe for TableConstraint
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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