<imgalign="right"src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<imgalign="right"src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](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{
funcisBoolean(flFieldLevel)bool{
switchfl.Field().Kind(){
casereflect.Bool:
returntrue
default:
_,err:=strconv.ParseBool(fl.Field().String())
_,err:=strconv.ParseBool(fl.Field().String())
returnerr==nil
returnerr==nil
}
}
}
// isDefault is the opposite of required aka hasValue
// isDefault is the opposite of required aka hasValue