first commit

This commit is contained in:
2020-10-25 10:00:59 +03:00
commit 0bd6f67397
80 changed files with 4741 additions and 0 deletions

16
validator/enum.go Normal file
View File

@@ -0,0 +1,16 @@
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)
}
}