1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 12:00:19 +00:00

Support Match validate function for tag

This commit is contained in:
miraclesu
2013-07-28 19:22:09 +08:00
parent dcdfaf36f1
commit 6662eef2fd
4 changed files with 67 additions and 18 deletions

View File

@ -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