package
1.3.48
Repository: https://github.com/sandwich-go/boost.git
Documentation: pkg.go.dev

# README

validator

通过 tag 或者 rules 进行数据校验

例子

type Test struct {
    Name string `val:"len=4"`
}

func main() {
    s := &Test{
        Name: "TEST",
    }
    err := Default.Struct(context.Background(), s)
    if err == nil {
        fmt.Println("validate ok")
    }   

    s.Name = ""
    err = Default.Struct(context.Background(), s)
    if err != nil {
        fmt.Println(err.Error())
    }
}

Output:

validate ok
Key: 'Test.Name' Error:Field validation for 'Name' failed on the 'len' tag

# Packages

No description provided by the author

# Functions

New returns a new Validator with sane defaults.

# Variables

No description provided by the author
No description provided by the author

# Interfaces

Validator validator.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author