ensureDefaultView builds the default view if not explicitly defined.
()
| 206 | |
| 207 | // ensureDefaultView builds the default view if not explicitly defined. |
| 208 | func (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. |