Skip to content

Commit 549397d

Browse files
author
Yash Jagdale
authored
added one of as example (#1135)
1 parent b293a5c commit 549397d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

_examples/simple/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type User struct {
1212
LastName string `validate:"required"`
1313
Age uint8 `validate:"gte=0,lte=130"`
1414
Email string `validate:"required,email"`
15+
Gender string `validate:"oneof=male female prefer_not_to`
1516
FavouriteColor string `validate:"iscolor"` // alias for 'hexcolor|rgb|rgba|hsl|hsla'
1617
Addresses []*Address `validate:"required,dive,required"` // a person can have a home and cottage...
1718
}
@@ -47,6 +48,7 @@ func validateStruct() {
4748
FirstName: "Badger",
4849
LastName: "Smith",
4950
Age: 135,
51+
Gender: "male",
5052
5153
FavouriteColor: "#000-",
5254
Addresses: []*Address{address},

0 commit comments

Comments
 (0)