diff --git a/README.md b/README.md index 467ddd4..ad65cb7 100644 --- a/README.md +++ b/README.md @@ -43,50 +43,6 @@ func main() { ### Kinds of validation -### Deep validation - -```go -package main - -import ( - "log" - - "github.com/guiferpa/gody" - "github.com/guiferpa/gody/rule" -) - -type Price struct { - Currency string `json:"currency" validate:"enum=BRL,EUR,USD"` - Value int `json:"value" validate:"min=10"` -} - -type ItemProduct struct { - Amount int `json:"amount" validate:"min=1"` - - // validate tag's necessary for validation works if not setted it'll be ignored - Price Price `json:"price" validate:"required=true"` -} - -func main() { - ip := ItemProduct{Amount: 10, Price: Price{"BYN", 10000}} - - if valid, err := gody.Validate(ip, nil); err != nil { - if !valid { - log.Println("product from cart didn't validate because of", err) - return - } - - switch err.(type) { - case *rule.ErrRequired: - log.Println("required error:", err) - break - - case *rule.ErrEnum: - log.Println("enum error:", err) - break - } - } -} -``` - -> You can access more [examples](https://github.com/guiferpa/gody/blob/master/example/validate.go) +- [Simple](https://github.com/guiferpa/gody/blob/master/example/validate.go#L11-L29) +- [Deep](https://github.com/guiferpa/gody/blob/master/example/validate.go#L84-L115) +- [Custom](https://github.com/guiferpa/gody/blob/master/example/validate.go#L31-L82)