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

Function primitiveAliasGoType

codegen/service/service_data.go:1232–1243  ·  view source on GitHub ↗

primitiveAliasGoType resolves the native Go type for a primitive alias branch. It uses expr.IsPrimitive to enforce the type contract and then unwraps aliases.

(dt expr.DataType)

Source from the content-addressed store, hash-verified

1230// primitiveAliasGoType resolves the native Go type for a primitive alias branch.
1231// It uses expr.IsPrimitive to enforce the type contract and then unwraps aliases.
1232func primitiveAliasGoType(dt expr.DataType) (string, bool) {
1233 if !expr.IsPrimitive(dt) {
1234 return "", false
1235 }
1236 for {
1237 ut, ok := dt.(expr.UserType)
1238 if !ok {
1239 return codegen.GoNativeTypeName(dt), true
1240 }
1241 dt = ut.Attribute().Type
1242 }
1243}
1244
1245// buildErrorInitData creates the data needed to generate code around endpoint error return values.
1246func buildErrorInitData(er *expr.ErrorExpr, scope *codegen.NameScope) *ErrorInitData {

Callers 2

buildUnionTypeDataFunction · 0.85
buildViewUnionTypeDataFunction · 0.85

Calls 3

IsPrimitiveFunction · 0.92
GoNativeTypeNameFunction · 0.92
AttributeMethod · 0.65

Tested by

no test coverage detected