MCPcopy Index your code
hub / github.com/cortexlabs/cortex / Bool

Function Bool

pkg/lib/configreader/bool.go:37–49  ·  view source on GitHub ↗
(inter interface{}, v *BoolValidation)

Source from the content-addressed store, hash-verified

35}
36
37func 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
51func BoolFromInterfaceMap(key string, iMap map[string]interface{}, v *BoolValidation) (bool, error) {
52 inter, ok := ReadInterfaceMapValue(key, iMap)

Callers 1

BoolFromInterfaceMapFunction · 0.70

Calls 3

ValidateBoolProvidedFunction · 0.85
ErrorCannotBeNullFunction · 0.85

Tested by

no test coverage detected