(inter interface{}, v *BoolValidation)
| 35 | } |
| 36 | |
| 37 | func Bool(inter interface{}, v *BoolValidation) (bool, error) { |
| 38 | if inter == nil { |
| 39 | if v.TreatNullAsFalse { |
| 40 | return ValidateBoolProvided(false, v) |
| 41 | } |
| 42 | return false, ErrorCannotBeNull(v.Required) |
| 43 | } |
| 44 | casted, castOk := inter.(bool) |
| 45 | if !castOk { |
| 46 | return false, ErrorInvalidPrimitiveType(inter, PrimTypeBool) |
| 47 | } |
| 48 | return ValidateBoolProvided(casted, v) |
| 49 | } |
| 50 | |
| 51 | func BoolFromInterfaceMap(key string, iMap map[string]interface{}, v *BoolValidation) (bool, error) { |
| 52 | inter, ok := ReadInterfaceMapValue(key, iMap) |
no test coverage detected