mirror of
https://github.com/astaxie/beego.git
synced 2025-07-10 14:41:03 +00:00
Support Match validate function for tag
This commit is contained in:
@ -55,9 +55,10 @@ Struct Tag Use:
|
||||
// validation function follow with "valid" tag
|
||||
// functions divide with ";"
|
||||
// parameters in parentheses "()" and divide with ","
|
||||
// Match function's pattern string must in "//"
|
||||
type user struct {
|
||||
Id int
|
||||
Name string `valid:"Required"`
|
||||
Name string `valid:"Required;Match(/^(test)?\\w*@;com$/)"`
|
||||
Age int `valid:"Required;Range(1, 140)"`
|
||||
}
|
||||
|
||||
@ -86,8 +87,7 @@ Struct Tag Functions:
|
||||
Alpha
|
||||
Numeric
|
||||
AlphaNumeric
|
||||
Match(regexp string) // does not support yet
|
||||
NoMatch(regexp string) // does not support yet
|
||||
Match(pattern string)
|
||||
AlphaDash
|
||||
Email
|
||||
IP
|
||||
|
Reference in New Issue
Block a user