AsUnion returns the type underlying union if any, nil otherwise.
(dt DataType)
| 229 | |
| 230 | // AsUnion returns the type underlying union if any, nil otherwise. |
| 231 | func 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. |
| 245 | func IsObject(dt DataType) bool { return AsObject(dt) != nil } |
no outgoing calls
no test coverage detected