MCPcopy Create free account
hub / github.com/cortexlabs/cortex / inferKey

Function inferKey

pkg/lib/configreader/reader.go:1212–1222  ·  view source on GitHub ↗
(structType reflect.Type, typeStructField string, typeKey string)

Source from the content-addressed store, hash-verified

1210}
1211
1212func inferKey(structType reflect.Type, typeStructField string, typeKey string) string {
1213 if typeKey != "" {
1214 return typeKey
1215 }
1216 field, _ := structType.Elem().FieldByName(typeStructField)
1217 tag, ok := getTagFieldName(field)
1218 if ok {
1219 return tag
1220 }
1221 return typeStructField
1222}
1223
1224func inferPromptFieldName(structType reflect.Type, typeStructField string) string {
1225 field, _ := structType.Elem().FieldByName(typeStructField)

Callers 2

StructFunction · 0.85
StructFromStringMapFunction · 0.85

Calls 1

getTagFieldNameFunction · 0.85

Tested by

no test coverage detected