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

Function InterfaceToInt32Slice

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

Source from the content-addressed store, hash-verified

466}
467
468func InterfaceToInt32Slice(in interface{}) ([]int32, bool) {
469 if in == nil {
470 return nil, true
471 }
472
473 if intSlice, ok := in.([]int32); ok {
474 return intSlice, true
475 }
476
477 inSlice, ok := InterfaceToInterfaceSlice(in)
478 if !ok {
479 return nil, false
480 }
481 out := make([]int32, len(inSlice))
482
483 for i, elem := range inSlice {
484 casted, ok := InterfaceToInt32(elem)
485 if !ok {
486 return nil, false
487 }
488 out[i] = casted
489 }
490 return out, true
491}
492
493func InterfaceToInt64Slice(in interface{}) ([]int64, bool) {
494 if in == nil {

Callers 1

Int32ListFunction · 0.92

Calls 2

InterfaceToInt32Function · 0.85

Tested by

no test coverage detected