mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-11 03:32:03 +08:00
merge conflicts resolved
This commit is contained in:
@@ -3,7 +3,7 @@ package validation
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
validator "github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// CheckYesOrNo - checks if a field on a struct is yes or no
|
||||
@@ -11,6 +11,11 @@ func CheckYesOrNo(fl validator.FieldLevel) bool {
|
||||
return fl.Field().String() == "yes" || fl.Field().String() == "no"
|
||||
}
|
||||
|
||||
// CheckYesOrNoOrUnset - checks if a field is yes, no or unset
|
||||
func CheckYesOrNoOrUnset(fl validator.FieldLevel) bool {
|
||||
return CheckYesOrNo(fl) || fl.Field().String() == "unset"
|
||||
}
|
||||
|
||||
// CheckRegex - check if a struct's field passes regex test
|
||||
func CheckRegex(fl validator.FieldLevel) bool {
|
||||
re := regexp.MustCompile(fl.Param())
|
||||
|
Reference in New Issue
Block a user