gf/geg/util/gvalid/gvalid_struct3.go

23 lines
476 B
Go
Raw Normal View History

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"`
2018-08-31 10:01:31 +08:00
ConfirmPassword string `gvalid:"confirm_password@password|same:password#|密码与确认密码不一致"`
}
user := &User{
Password : "123456",
2018-08-31 10:01:31 +08:00
ConfirmPassword : "",
}
gutil.Dump(gvalid.CheckStruct(user, nil))
}