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

Function Float64

pkg/lib/configreader/float64.go:44–56  ·  view source on GitHub ↗
(inter interface{}, v *Float64Validation)

Source from the content-addressed store, hash-verified

42}
43
44func Float64(inter interface{}, v *Float64Validation) (float64, error) {
45 if inter == nil {
46 if v.TreatNullAsZero {
47 return ValidateFloat64Provided(0, v)
48 }
49 return 0, ErrorCannotBeNull(v.Required)
50 }
51 casted, castOk := cast.InterfaceToFloat64(inter)
52 if !castOk {
53 return 0, ErrorInvalidPrimitiveType(inter, PrimTypeFloat)
54 }
55 return ValidateFloat64Provided(casted, v)
56}
57
58func Float64FromInterfaceMap(key string, iMap map[string]interface{}, v *Float64Validation) (float64, error) {
59 inter, ok := ReadInterfaceMapValue(key, iMap)

Callers 1

Float64FromInterfaceMapFunction · 0.70

Calls 4

InterfaceToFloat64Function · 0.92
ValidateFloat64ProvidedFunction · 0.85
ErrorCannotBeNullFunction · 0.85

Tested by

no test coverage detected