Convenience methods AsObject returns the type underlying object if any, nil otherwise.
(dt DataType)
| 187 | |
| 188 | // AsObject returns the type underlying object if any, nil otherwise. |
| 189 | func 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. |
| 203 | func AsArray(dt DataType) *Array { |
no outgoing calls