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

Function AsObject

expr/types.go:189–200  ·  view source on GitHub ↗

Convenience methods AsObject returns the type underlying object if any, nil otherwise.

(dt DataType)

Source from the content-addressed store, hash-verified

187
188// AsObject returns the type underlying object if any, nil otherwise.
189func AsObject(dt DataType) *Object {
190 switch t := dt.(type) {
191 case *UserTypeExpr:
192 return AsObject(t.Type)
193 case *ResultTypeExpr:
194 return AsObject(t.Type)
195 case *Object:
196 return t
197 default:
198 return nil
199 }
200}
201
202// AsArray returns the type underlying array if any, nil otherwise.
203func AsArray(dt DataType) *Array {

Callers 15

TestHTTPEndpointPrepareFunction · 0.92
TestHTTPResponseCookieFunction · 0.92
TestCookieAPIKeySecurityFunction · 0.92
analyzeMethod · 0.92
buildPayloadDataMethod · 0.92
buildResultDataMethod · 0.92
buildResponsesMethod · 0.92
buildErrorsDataMethod · 0.92
buildRequestBodyTypeMethod · 0.92

Calls

no outgoing calls

Tested by 12

TestHTTPEndpointPrepareFunction · 0.74
TestHTTPResponseCookieFunction · 0.74
TestCookieAPIKeySecurityFunction · 0.74
TestProtoBufTransformFunction · 0.74
TestMethodFunction · 0.74
TestInterceptorFunction · 0.74
TestAsObjectFunction · 0.68
TestProjectFunction · 0.68
resultRecursiveFunction · 0.68