AsDOid attempts to retrieve a DOid from an Expr, returning a DOid and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DOid wrapped by a *DOidWrapper is possible.
(e Expr)
| 3545 | // be used instead of direct type assertions wherever a *DOid wrapped by a |
| 3546 | // *DOidWrapper is possible. |
| 3547 | func AsDOid(e Expr) (*DOid, bool) { |
| 3548 | switch t := e.(type) { |
| 3549 | case *DOid: |
| 3550 | return t, true |
| 3551 | case *DOidWrapper: |
| 3552 | return AsDOid(t.Wrapped) |
| 3553 | } |
| 3554 | return NewDOid(0), false |
| 3555 | } |
| 3556 | |
| 3557 | // MustBeDOid attempts to retrieve a DOid from an Expr, panicking if the |
| 3558 | // assertion fails. |
no test coverage detected
searching dependent graphs…