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

Function InterfaceToFloat64Slice

pkg/lib/cast/interface.go:543–566  ·  view source on GitHub ↗
(in interface{})

Source from the content-addressed store, hash-verified

541}
542
543func InterfaceToFloat64Slice(in interface{}) ([]float64, bool) {
544 if in == nil {
545 return nil, true
546 }
547
548 if floatSlice, ok := in.([]float64); ok {
549 return floatSlice, true
550 }
551
552 inSlice, ok := InterfaceToInterfaceSlice(in)
553 if !ok {
554 return nil, false
555 }
556 out := make([]float64, len(inSlice))
557
558 for i, elem := range inSlice {
559 casted, ok := InterfaceToFloat64(elem)
560 if !ok {
561 return nil, false
562 }
563 out[i] = casted
564 }
565 return out, true
566}
567
568func InterfaceToStrSlice(in interface{}) ([]string, bool) {
569 if in == nil {

Callers 1

Float64ListFunction · 0.92

Calls 2

InterfaceToFloat64Function · 0.85

Tested by

no test coverage detected