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

Function StringList

pkg/lib/configreader/string_list.go:43–57  ·  view source on GitHub ↗
(inter interface{}, v *StringListValidation)

Source from the content-addressed store, hash-verified

41}
42
43func StringList(inter interface{}, v *StringListValidation) ([]string, error) {
44 casted, castOk := cast.InterfaceToStrSlice(inter)
45 if !castOk {
46 if v.CastSingleItem {
47 castedItem, castOk := inter.(string)
48 if !castOk {
49 return nil, ErrorInvalidPrimitiveType(inter, PrimTypeString, PrimTypeStringList)
50 }
51 casted = []string{castedItem}
52 } else {
53 return nil, ErrorInvalidPrimitiveType(inter, PrimTypeStringList)
54 }
55 }
56 return ValidateStringListProvided(casted, v)
57}
58
59func StringListFromInterfaceMap(key string, iMap map[string]interface{}, v *StringListValidation) ([]string, error) {
60 inter, ok := ReadInterfaceMapValue(key, iMap)

Callers 1

Calls 3

InterfaceToStrSliceFunction · 0.92

Tested by

no test coverage detected