Skip to main content

Module rules

Module rules 

Source
Expand description

§校验规则函数(8 种)

每个函数返回 Result<(), ValidationError>,可组合使用 aggregate 聚合。

Functions§

validate_contains
验证包含子串
validate_custom
自定义校验失败
validate_does_not_contain
验证不包含子串
validate_email
验证邮箱格式
validate_length
验证字符串长度在 [min, max] 范围内(Unicode 安全,按字符计数)
validate_range
验证数值在 [min, max] 范围内
validate_regex
验证正则匹配
validate_required
验证非空