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

Function isUnionMessage

grpc/codegen/protobuf_transform.go:1122–1137  ·  view source on GitHub ↗

isUnionMessage returns true if the given attribute is a union message.

(at *expr.AttributeExpr)

Source from the content-addressed store, hash-verified

1120
1121// isUnionMessage returns true if the given attribute is a union message.
1122func isUnionMessage(at *expr.AttributeExpr) bool {
1123 ut, ok := at.Type.(expr.UserType)
1124 if !ok {
1125 return false
1126 }
1127 obj := expr.AsObject(ut.Attribute().Type)
1128 if obj == nil {
1129 return false
1130 }
1131 for _, nat := range *obj {
1132 if expr.IsUnion(nat.Attribute.Type) {
1133 return true
1134 }
1135 }
1136 return false
1137}
1138
1139// dupTransformAttrs returns a shallow copy of the given transformAttrs.
1140func dupTransformAttrs(ta *transformAttrs) *transformAttrs {

Callers 2

transformAttributeFunction · 0.85
collectHelpersFunction · 0.85

Calls 3

AsObjectFunction · 0.92
IsUnionFunction · 0.92
AttributeMethod · 0.65

Tested by

no test coverage detected