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

validation: support required option for some struct tag valids

This commit is contained in:
miraclesu
2017-07-03 16:14:29 +08:00
parent 82586c70e9
commit e72b02b7cc
4 changed files with 81 additions and 0 deletions

View File

@ -64,6 +64,9 @@ Struct Tag Use:
func main() {
valid := validation.Validation{}
// ignore empty field valid
// see CanSkipFuncs
// valid := validation.Validation{RequiredFirst:true}
u := user{Name: "test", Age: 40}
b, err := valid.Valid(u)
if err != nil {