gf/geg/util/gvalid/gvalid_struct3.go
2018-08-31 10:01:31 +08:00

23 lines
476 B
Go

package main
import (
"gitee.com/johng/gf/g/util/gutil"
"gitee.com/johng/gf/g/util/gvalid"
)
// same校验
func main() {
type User struct {
Password string `gvalid:"password@password"`
ConfirmPassword string `gvalid:"confirm_password@password|same:password#|密码与确认密码不一致"`
}
user := &User{
Password : "123456",
ConfirmPassword : "",
}
gutil.Dump(gvalid.CheckStruct(user, nil))
}