pub struct PgConstraint { /* private fields */ }Expand description
PostgreSQL constraint metadata without database introspection.
Implementations§
Source§impl PgConstraint
impl PgConstraint
Sourcepub const fn new(kind: PgConstraintKind) -> Self
pub const fn new(kind: PgConstraintKind) -> Self
Creates constraint metadata from a kind.
Sourcepub fn with_name(self, name: PgConstraintName) -> Self
pub fn with_name(self, name: PgConstraintName) -> Self
Adds a constraint name.
Sourcepub fn with_columns(self, columns: Vec<PgColumnName>) -> Self
pub fn with_columns(self, columns: Vec<PgColumnName>) -> Self
Adds constrained columns.
Sourcepub fn with_referenced_table(self, table: PgTableRef) -> Self
pub fn with_referenced_table(self, table: PgTableRef) -> Self
Adds referenced table metadata for a foreign key.
Sourcepub fn with_expression(
self,
expression: impl AsRef<str>,
) -> Result<Self, PgConstraintError>
pub fn with_expression( self, expression: impl AsRef<str>, ) -> Result<Self, PgConstraintError>
Adds an expression label for check or exclusion metadata without parsing SQL.
§Errors
Returns PgConstraintError when the label is empty or contains control characters.
Sourcepub const fn with_deferrability(self, deferrability: PgDeferrability) -> Self
pub const fn with_deferrability(self, deferrability: PgDeferrability) -> Self
Sets the deferrability metadata.
Sourcepub const fn kind(&self) -> PgConstraintKind
pub const fn kind(&self) -> PgConstraintKind
Returns the constraint kind.
Sourcepub const fn name(&self) -> Option<&PgConstraintName>
pub const fn name(&self) -> Option<&PgConstraintName>
Returns the optional constraint name.
Sourcepub fn columns(&self) -> &[PgColumnName]
pub fn columns(&self) -> &[PgColumnName]
Returns the constrained columns.
Sourcepub const fn referenced_table(&self) -> Option<&PgTableRef>
pub const fn referenced_table(&self) -> Option<&PgTableRef>
Returns the optional referenced table.
Sourcepub fn expression(&self) -> Option<&str>
pub fn expression(&self) -> Option<&str>
Returns the optional expression label.
Sourcepub const fn deferrability(&self) -> PgDeferrability
pub const fn deferrability(&self) -> PgDeferrability
Returns the deferrability metadata.
Trait Implementations§
Source§impl Clone for PgConstraint
impl Clone for PgConstraint
Source§fn clone(&self) -> PgConstraint
fn clone(&self) -> PgConstraint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PgConstraint
impl Debug for PgConstraint
Source§impl Display for PgConstraint
impl Display for PgConstraint
Source§impl Hash for PgConstraint
impl Hash for PgConstraint
Source§impl Ord for PgConstraint
impl Ord for PgConstraint
Source§fn cmp(&self, other: &PgConstraint) -> Ordering
fn cmp(&self, other: &PgConstraint) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PgConstraint
impl PartialEq for PgConstraint
Source§fn eq(&self, other: &PgConstraint) -> bool
fn eq(&self, other: &PgConstraint) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PgConstraint
impl PartialOrd for PgConstraint
impl Eq for PgConstraint
impl StructuralPartialEq for PgConstraint
Auto Trait Implementations§
impl Freeze for PgConstraint
impl RefUnwindSafe for PgConstraint
impl Send for PgConstraint
impl Sync for PgConstraint
impl Unpin for PgConstraint
impl UnsafeUnpin for PgConstraint
impl UnwindSafe for PgConstraint
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