pub struct UniqueConstraint {
pub table: Cow<'static, str>,
pub name: Cow<'static, str>,
pub columns: Cow<'static, [Cow<'static, str>]>,
pub name_explicit: bool,
}Expand description
A unique constraint, as stored in migration snapshots.
Fields§
§table: Cow<'static, str>Parent table name
name: Cow<'static, str>Constraint name
columns: Cow<'static, [Cow<'static, str>]>Columns in the unique constraint
name_explicit: boolWhether the user gave the constraint name (rather than it being generated)
Implementations§
Source§impl UniqueConstraint
impl UniqueConstraint
Sourcepub fn to_constraint_sql(&self) -> String
pub fn to_constraint_sql(&self) -> String
Renders CONSTRAINT name UNIQUE(...).
Source§impl UniqueConstraint
impl UniqueConstraint
Sourcepub fn new(
table: impl Into<Cow<'static, str>>,
name: impl Into<Cow<'static, str>>,
columns: impl Into<Cow<'static, [Cow<'static, str>]>>,
) -> Self
pub fn new( table: impl Into<Cow<'static, str>>, name: impl Into<Cow<'static, str>>, columns: impl Into<Cow<'static, [Cow<'static, str>]>>, ) -> Self
Creates a unique constraint.
Trait Implementations§
Source§impl Clone for UniqueConstraint
impl Clone for UniqueConstraint
Source§impl Debug for UniqueConstraint
impl Debug for UniqueConstraint
Source§impl Default for UniqueConstraint
impl Default for UniqueConstraint
impl Eq for UniqueConstraint
Source§impl From<UniqueConstraintDef> for UniqueConstraint
impl From<UniqueConstraintDef> for UniqueConstraint
Source§fn from(def: UniqueConstraintDef) -> Self
fn from(def: UniqueConstraintDef) -> Self
Converts to this type from the input type.
Source§impl PartialEq for UniqueConstraint
impl PartialEq for UniqueConstraint
impl StructuralPartialEq for UniqueConstraint
Auto Trait Implementations§
impl Freeze for UniqueConstraint
impl RefUnwindSafe for UniqueConstraint
impl Send for UniqueConstraint
impl Sync for UniqueConstraint
impl Unpin for UniqueConstraint
impl UnsafeUnpin for UniqueConstraint
impl UnwindSafe for UniqueConstraint
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