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

Function AsUnion

expr/types.go:231–242  ·  view source on GitHub ↗

AsUnion returns the type underlying union if any, nil otherwise.

(dt DataType)

Source from the content-addressed store, hash-verified

229
230// AsUnion returns the type underlying union if any, nil otherwise.
231func AsUnion(dt DataType) *Union {
232 switch t := dt.(type) {
233 case *UserTypeExpr:
234 return AsUnion(t.Type)
235 case *ResultTypeExpr:
236 return AsUnion(t.Type)
237 case *Union:
238 return t
239 default:
240 return nil
241 }
242}
243
244// IsObject returns true if the data type is an object.
245func IsObject(dt DataType) bool { return AsObject(dt) != nil }

Callers 15

transformUnionDataFunction · 0.92
collectHelpersFunction · 0.92
buildStreamEnvelopeDataFunction · 0.92
makeProtoBufMessageRFunction · 0.92
transformUnionFunction · 0.92
collectHelpersFunction · 0.92
recurseValidationCodeFunction · 0.92
PkgMethod · 0.92
validateGRPCUnionShapesFunction · 0.85
UnionToObjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected