gf/.example/util/gvalid/gvalid_struct3.go

20 lines
308 B
Go

package main
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gvalid"
)
// same校验
func main() {
type User struct {
Pass string `gvalid:"passwd1 @required|length:2,20|password3||密码强度不足"`
}
user := &User{
Pass: "1",
}
g.Dump(gvalid.CheckStruct(user, nil).Maps())
}