pub struct DataValidationRule {
pub condition_type: String,
pub range: String,
pub condition_values: Option<Vec<String>>,
pub strict: bool,
pub input_message: Option<String>,
pub error_message: Option<String>,
pub data_validation_id: Option<String>,
}Expand description
数据校验规则
Fields§
§condition_type: String数据校验类型
range: String应用范围
condition_values: Option<Vec<String>>校验条件值
strict: bool是否拒绝输入
input_message: Option<String>输入提示消息
error_message: Option<String>错误提示消息
data_validation_id: Option<String>数据校验 ID(仅在响应时存在)
Implementations§
Source§impl DataValidationRule
impl DataValidationRule
Sourcepub fn number_range(range: impl ToString, min: f64, max: f64) -> Self
pub fn number_range(range: impl ToString, min: f64, max: f64) -> Self
创建数字范围校验
Sourcepub fn text_length(
range: impl ToString,
min_length: u32,
max_length: u32,
) -> Self
pub fn text_length( range: impl ToString, min_length: u32, max_length: u32, ) -> Self
创建文本长度校验
Sourcepub fn with_input_message(self, message: impl ToString) -> Self
pub fn with_input_message(self, message: impl ToString) -> Self
设置输入提示
Sourcepub fn with_error_message(self, message: impl ToString) -> Self
pub fn with_error_message(self, message: impl ToString) -> Self
设置错误提示
Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
设置是否严格模式
Trait Implementations§
Source§impl Debug for DataValidationRule
impl Debug for DataValidationRule
Source§impl Default for DataValidationRule
impl Default for DataValidationRule
Source§fn default() -> DataValidationRule
fn default() -> DataValidationRule
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DataValidationRule
impl<'de> Deserialize<'de> for DataValidationRule
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
Auto Trait Implementations§
impl Freeze for DataValidationRule
impl RefUnwindSafe for DataValidationRule
impl Send for DataValidationRule
impl Sync for DataValidationRule
impl Unpin for DataValidationRule
impl UnwindSafe for DataValidationRule
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