MCPcopy
hub / github.com/cortexlabs/cortex / InterfaceToInt64Slice

Function InterfaceToInt64Slice

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

Source from the content-addressed store, hash-verified

491}
492
493func InterfaceToInt64Slice(in interface{}) ([]int64, bool) {
494 if in == nil {
495 return nil, true
496 }
497
498 if intSlice, ok := in.([]int64); ok {
499 return intSlice, true
500 }
501
502 inSlice, ok := InterfaceToInterfaceSlice(in)
503 if !ok {
504 return nil, false
505 }
506 out := make([]int64, len(inSlice))
507
508 for i, elem := range inSlice {
509 casted, ok := InterfaceToInt64(elem)
510 if !ok {
511 return nil, false
512 }
513 out[i] = casted
514 }
515 return out, true
516}
517
518func InterfaceToFloat32Slice(in interface{}) ([]float32, bool) {
519 if in == nil {

Callers 1

Int64ListFunction · 0.92

Calls 2

InterfaceToInt64Function · 0.85

Tested by

no test coverage detected