Skip to content

Commit

Permalink
added one of as example (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash Jagdale authored Aug 6, 2023
1 parent b293a5c commit 549397d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _examples/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type User struct {
LastName string `validate:"required"`
Age uint8 `validate:"gte=0,lte=130"`
Email string `validate:"required,email"`
Gender string `validate:"oneof=male female prefer_not_to`
FavouriteColor string `validate:"iscolor"` // alias for 'hexcolor|rgb|rgba|hsl|hsla'
Addresses []*Address `validate:"required,dive,required"` // a person can have a home and cottage...
}
Expand Down Expand Up @@ -47,6 +48,7 @@ func validateStruct() {
FirstName: "Badger",
LastName: "Smith",
Age: 135,
Gender: "male",
Email: "[email protected]",
FavouriteColor: "#000-",
Addresses: []*Address{address},
Expand Down

0 comments on commit 549397d

Please sign in to comment.