pub enum ValidationRule {
Range {
min: Option<f64>,
max: Option<f64>,
},
Length {
min: Option<usize>,
max: Option<usize>,
},
Pattern(String),
Email,
Url,
Required,
Custom {
name: String,
message: Option<String>,
},
}Expand description
バリデーションルール
Variants§
Range
範囲チェック
Length
文字列長さチェック
Pattern(String)
正規表現パターン
メールアドレス形式
Url
URL形式
Required
必須フィールド
Custom
カスタムバリデーション
Implementations§
Source§impl ValidationRule
impl ValidationRule
Sourcepub fn to_typescript_check(&self, field_name: &str) -> String
pub fn to_typescript_check(&self, field_name: &str) -> String
TypeScriptのバリデーションコードを生成
Sourcepub fn to_zod_schema(&self, is_bigint: bool) -> String
pub fn to_zod_schema(&self, is_bigint: bool) -> String
Zodスキーマコードを生成
Trait Implementations§
Source§impl Clone for ValidationRule
impl Clone for ValidationRule
Source§fn clone(&self) -> ValidationRule
fn clone(&self) -> ValidationRule
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 ValidationRule
impl Debug for ValidationRule
Source§impl<'de> Deserialize<'de> for ValidationRule
impl<'de> Deserialize<'de> for ValidationRule
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ValidationRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ValidationRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ValidationRule
impl Serialize for ValidationRule
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ValidationRule
impl RefUnwindSafe for ValidationRule
impl Send for ValidationRule
impl Sync for ValidationRule
impl Unpin for ValidationRule
impl UnwindSafe for ValidationRule
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