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

Function GetMetaType

codegen/import.go:104–120  ·  view source on GitHub ↗

GetMetaType retrieves the type and package defined by the struct:field:type metadata if any.

(att *expr.AttributeExpr)

Source from the content-addressed store, hash-verified

102// GetMetaType retrieves the type and package defined by the struct:field:type
103// metadata if any.
104func GetMetaType(att *expr.AttributeExpr) (typeName string, importS *ImportSpec) {
105 if att == nil {
106 return
107 }
108 if args, ok := att.Meta["struct:field:type"]; ok {
109 if len(args) > 0 {
110 typeName = args[0]
111 }
112 if len(args) > 1 {
113 importS = &ImportSpec{Path: args[1]}
114 }
115 if len(args) > 2 {
116 importS.Name = args[2]
117 }
118 }
119 return
120}
121
122// GetMetaTypeImports parses the attribute for all user defined imports
123func GetMetaTypeImports(att *expr.AttributeExpr) []*ImportSpec {

Callers 10

goTypeDefFunction · 0.92
isStringMetaTypeFunction · 0.92
transformObjectFunction · 0.92
convertTypeFunction · 0.92
safelyGetMetaTypeImportsFunction · 0.85
transformObjectFunction · 0.85
validationCodeFunction · 0.85
GoFullTypeNameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected