mirror of https://github.com/portainer/portainer
18 lines
360 B
Go
18 lines
360 B
Go
|
package validate
|
||
|
|
||
|
import (
|
||
|
"github.com/go-playground/validator/v10"
|
||
|
)
|
||
|
|
||
|
func registerValidationMethods(v *validator.Validate) {
|
||
|
v.RegisterValidation("validate_bool", ValidateBool)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Validation methods below are being used for custom validation
|
||
|
*/
|
||
|
func ValidateBool(fl validator.FieldLevel) bool {
|
||
|
_, ok := fl.Field().Interface().(bool)
|
||
|
return ok
|
||
|
}
|