AsDArray attempts to retrieve a *DArray from an Expr, returning a *DArray and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DArray wrapped by a *DOidWrapper is possible.
(e Expr)
| 4997 | // be used instead of direct type assertions wherever a *DArray wrapped by a |
| 4998 | // *DOidWrapper is possible. |
| 4999 | func AsDArray(e Expr) (*DArray, bool) { |
| 5000 | switch t := e.(type) { |
| 5001 | case *DArray: |
| 5002 | return t, true |
| 5003 | case *DOidWrapper: |
| 5004 | return AsDArray(t.Wrapped) |
| 5005 | } |
| 5006 | return nil, false |
| 5007 | } |
| 5008 | |
| 5009 | // MustBeDArray attempts to retrieve a *DArray from an Expr, panicking if the |
| 5010 | // assertion fails. |
no outgoing calls
no test coverage detected
searching dependent graphs…