mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 21:28:22 +08:00
23 lines
476 B
Go
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))
|
|
}
|