A validation library in Pure Go.
To see the list of options, you can refer to the options page.
go get github.com/Jh123x/go-validate
package main
import (
"github.com/Jh123x/go-validate/options"
"github.com/Jh123x/go-validate/validator"
)
func main(){
lazyValidator := validator.NewLazyValidator()
err := lazyValidator.WithOptions(
options.IsNotEmpty("").WithError(fmt.Errorf("empty string")), // Fails and returns error.
options.IsLength([]string{}, 0, 3).WithError(fmt.Errorf("empty string")), // Will not be evaluated.
).Validate()
if err != nil {
// handle error
...
}
}
An example usage is shown in the code snippet above. To see a full list of options, you can refer to the options page.
Please create an issue if you have any: