pub struct AsyncUniqueRule {
pub table: String,
pub column: String,
pub message: Option<String>,
}Expand description
Database uniqueness validation rule.
Validates that a value is unique in a database table column.
Fields§
§table: StringDatabase table name
column: StringColumn name to check
message: Option<String>Custom error message
Implementations§
Trait Implementations§
Source§impl AsyncValidationRule<String> for AsyncUniqueRule
impl AsyncValidationRule<String> for AsyncUniqueRule
Source§fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 String,
ctx: &'life2 ValidationContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 String,
ctx: &'life2 ValidationContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Validate the value asynchronously.
Source§fn default_message(&self) -> String
fn default_message(&self) -> String
Get the default error message for this rule.
Source§impl AsyncValidationRule<str> for AsyncUniqueRule
impl AsyncValidationRule<str> for AsyncUniqueRule
Source§fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 str,
ctx: &'life2 ValidationContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 str,
ctx: &'life2 ValidationContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Validate the value asynchronously.
Source§fn default_message(&self) -> String
fn default_message(&self) -> String
Get the default error message for this rule.
Source§impl Clone for AsyncUniqueRule
impl Clone for AsyncUniqueRule
Source§fn clone(&self) -> AsyncUniqueRule
fn clone(&self) -> AsyncUniqueRule
Returns a duplicate 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 AsyncUniqueRule
impl Debug for AsyncUniqueRule
Source§impl<'de> Deserialize<'de> for AsyncUniqueRule
impl<'de> Deserialize<'de> for AsyncUniqueRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AsyncUniqueRule> for SerializableRule
impl From<AsyncUniqueRule> for SerializableRule
Source§fn from(rule: AsyncUniqueRule) -> Self
fn from(rule: AsyncUniqueRule) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AsyncUniqueRule
impl PartialEq for AsyncUniqueRule
Source§impl Serialize for AsyncUniqueRule
impl Serialize for AsyncUniqueRule
impl StructuralPartialEq for AsyncUniqueRule
Auto Trait Implementations§
impl Freeze for AsyncUniqueRule
impl RefUnwindSafe for AsyncUniqueRule
impl Send for AsyncUniqueRule
impl Sync for AsyncUniqueRule
impl Unpin for AsyncUniqueRule
impl UnwindSafe for AsyncUniqueRule
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