You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
280 B

package validator
import "gitoa.ru/go-4devs/console/input"
func Enum(enum ...string) func(input.Value) error {
return func(in input.Value) error {
v := in.String()
for _, e := range enum {
if e == v {
return nil
}
}
return NewError(ErrInvalid, v, enum)
}
}