<imgalign="right"src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
// isBoolean is the validation function for validating if the current field's value can be safely converted to a boolean.
// isBoolean is the validation function for validating if the current field's value is a valid boolean value or can be safely converted to a boolean value.
funcisBoolean(flFieldLevel)bool{
_,err:=strconv.ParseBool(fl.Field().String())
returnerr==nil
switchfl.Field().Kind(){
casereflect.Bool:
returntrue
default:
_,err:=strconv.ParseBool(fl.Field().String())
returnerr==nil
}
}
// isDefault is the opposite of required aka hasValue