refactored nodes model

This commit is contained in:
afeiszli
2021-07-24 16:13:24 -04:00
parent a982b62445
commit fd223e3d4a
9 changed files with 269 additions and 343 deletions

16
models/validation.go Normal file
View File

@@ -0,0 +1,16 @@
package models
import (
"regexp"
"github.com/go-playground/validator/v10"
)
func CheckYesOrNo(fl validator.FieldLevel) bool {
return fl.Field().String() == "yes" || fl.Field().String() == "no"
}
func CheckRegex(fl validator.FieldLevel) bool {
re := regexp.MustCompile(fl.Param())
return re.MatchString(fl.Field().String())
}