pub trait SqlError: Sized {
// Required methods
fn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>;
fn is_fk_violation(&self) -> bool;
fn is_unique_violation(&self) -> bool;
fn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>;
}Expand description
Trait for mapping certain postgres errors.
Required Methods§
Sourcefn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>
fn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>
Map a foreign key violation to a different error type.
Sourcefn is_fk_violation(&self) -> bool
fn is_fk_violation(&self) -> bool
Returns if the SQL error is a foreign key violation.
Sourcefn is_unique_violation(&self) -> bool
fn is_unique_violation(&self) -> bool
Returns if the SQL error is a unique violation.
Sourcefn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>
fn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>
Map a unique violation to a different error type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.