MCPcopy Create free account
hub / github.com/goadesign/goa / QualifiedTypeName

Function QualifiedTypeName

expr/types.go:684–701  ·  view source on GitHub ↗

QualifiedTypeName returns the qualified type name for the given data type. The qualified type name includes the name of the type of the elements of array or map types. This is useful in reporting types in error messages, examples of qualified type names: "array " "map " "ma

(t DataType)

Source from the content-addressed store, hash-verified

682// "map<string, string>"
683// "map<string, array<int32>>"
684func QualifiedTypeName(t DataType) string {
685 switch t.Kind() {
686 case ArrayKind:
687 a := t.(*Array)
688 return fmt.Sprintf("%s<%s>",
689 t.Name(),
690 QualifiedTypeName(a.ElemType.Type),
691 )
692 case MapKind:
693 h := t.(*Map)
694 return fmt.Sprintf("%s<%s, %s>",
695 t.Name(),
696 QualifiedTypeName(h.KeyType.Type),
697 QualifiedTypeName(h.ElemType.Type),
698 )
699 }
700 return t.Name()
701}
702
703// toReflectType converts the DataType to reflect.Type.
704func toReflectType(dtype DataType) reflect.Type {

Callers 2

DefaultFunction · 0.92
TestQualifiedTypeNameFunction · 0.85

Calls 2

KindMethod · 0.65
NameMethod · 0.65

Tested by 1

TestQualifiedTypeNameFunction · 0.68