Enum sqlparser::ast::TableConstraint
source · [−]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
Fields
is_primary: bool
Whether this is a PRIMARY KEY
or just a UNIQUE
constraint
[ CONSTRAINT <name> ] { PRIMARY KEY | UNIQUE } (<columns>)
ForeignKey
Fields
foreign_table: ObjectName
on_delete: Option<ReferentialAction>
on_update: Option<ReferentialAction>
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>] }
).
Check
[ CONSTRAINT <name> ] CHECK (<expr>)
Trait Implementations
sourceimpl Clone for TableConstraint
impl Clone for TableConstraint
sourcefn clone(&self) -> TableConstraint
fn clone(&self) -> TableConstraint
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TableConstraint
impl Debug for TableConstraint
sourceimpl Display for TableConstraint
impl Display for TableConstraint
sourceimpl Hash for TableConstraint
impl Hash for TableConstraint
sourceimpl PartialEq<TableConstraint> for TableConstraint
impl PartialEq<TableConstraint> for TableConstraint
sourcefn eq(&self, other: &TableConstraint) -> bool
fn eq(&self, other: &TableConstraint) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TableConstraint) -> bool
fn ne(&self, other: &TableConstraint) -> bool
This method tests for !=
.
impl Eq for TableConstraint
impl StructuralEq for TableConstraint
impl StructuralPartialEq for TableConstraint
Auto Trait Implementations
impl RefUnwindSafe for TableConstraint
impl Send for TableConstraint
impl Sync for TableConstraint
impl Unpin for TableConstraint
impl UnwindSafe for TableConstraint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more