As of v9, i don't see a way to validate a struct field that can only take values from a restricted set of possible values. This is meant to act as a replacement for sum types (enums).
Example use case: Making sure that User.Gender can take values within []string{"male", "female", "n/a"}
Any suggestions?
As of v9, i don't see a way to validate a struct field that can only take values from a restricted set of possible values. This is meant to act as a replacement for sum types (enums).
Example use case: Making sure that
User.Gendercan take values within[]string{"male", "female", "n/a"}Any suggestions?