gf/.example/util/gvalid/gvalid_struct2.go

19 lines
275 B
Go

package main
import (
"context"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gvalid"
)
// string默认值校验
func main() {
type User struct {
Uid string `gvalid:"uid@integer"`
}
user := &User{}
g.Dump(gvalid.CheckStruct(context.TODO(), user, nil))
}