mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 21:28:22 +08:00
23 lines
461 B
Go
23 lines
461 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/g"
|
|
"github.com/gogf/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 : "",
|
|
}
|
|
|
|
g.Dump(gvalid.CheckStruct(user, nil))
|
|
}
|