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

Function InterfaceToStrInterfaceMapSlice

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

Source from the content-addressed store, hash-verified

618}
619
620func InterfaceToStrInterfaceMapSlice(in interface{}) ([]map[string]interface{}, bool) {
621 if in == nil {
622 return nil, true
623 }
624
625 if strMapSlice, ok := in.([]map[string]interface{}); ok {
626 return strMapSlice, true
627 }
628
629 inSlice, ok := InterfaceToInterfaceSlice(in)
630 if !ok {
631 return nil, false
632 }
633
634 out := make([]map[string]interface{}, len(inSlice))
635
636 for i, elem := range inSlice {
637 casted, ok := InterfaceToStrInterfaceMap(elem)
638 if !ok {
639 return nil, false
640 }
641 out[i] = casted
642 }
643 return out, true
644}
645
646func InterfaceToInterfaceInterfaceMap(in interface{}) (map[interface{}]interface{}, bool) {
647 if in == nil {

Callers 2

ExtractAPIConfigsFunction · 0.92
InterfaceMapListFunction · 0.92

Calls 2

Tested by

no test coverage detected