mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
gdb.Value增加IsNil方法
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"gitee.com/johng/gf/g/util/gconv"
|
||||
)
|
||||
|
||||
func (v Value) IsNil() bool { return v == nil }
|
||||
func (v Value) Bytes() []byte { return []byte(v) }
|
||||
func (v Value) String() string { return string(v.Bytes()) }
|
||||
func (v Value) Bool() bool { return gconv.Bool(v.Bytes()) }
|
||||
|
||||
@ -10,12 +10,12 @@ import (
|
||||
func main() {
|
||||
type User struct {
|
||||
Password string `gvalid:"password@password"`
|
||||
ConfiemPassword string `gvalid:"confirm_password@password|same:password#|密码与确认密码不一致"`
|
||||
ConfirmPassword string `gvalid:"confirm_password@password|same:password#|密码与确认密码不一致"`
|
||||
}
|
||||
|
||||
user := &User{
|
||||
Password : "123456",
|
||||
ConfiemPassword : "",
|
||||
ConfirmPassword : "",
|
||||
}
|
||||
|
||||
gutil.Dump(gvalid.CheckStruct(user, nil))
|
||||
|
||||
Reference in New Issue
Block a user