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

Method ensureDefaultView

expr/result_type.go:208–221  ·  view source on GitHub ↗

ensureDefaultView builds the default view if not explicitly defined.

()

Source from the content-addressed store, hash-verified

206
207// ensureDefaultView builds the default view if not explicitly defined.
208func (rt *ResultTypeExpr) ensureDefaultView() {
209 if rt.View(DefaultView) == nil {
210 att := DupAtt(rt.AttributeExpr)
211 if arr := AsArray(att.Type); arr != nil {
212 att.Type = AsObject(arr.ElemType.Type)
213 }
214 v := &ViewExpr{
215 AttributeExpr: att,
216 Name: DefaultView,
217 Parent: rt,
218 }
219 rt.Views = append(rt.Views, v)
220 }
221}
222
223// Project creates a ResultTypeExpr containing the fields defined in the view
224// expression of m named after the view argument.

Callers 1

FinalizeMethod · 0.95

Calls 4

ViewMethod · 0.95
DupAttFunction · 0.85
AsArrayFunction · 0.85
AsObjectFunction · 0.85

Tested by

no test coverage detected