wrapWithOid wraps a Datum with a custom Oid.
(d Datum, oid oid.Oid)
| 5838 | |
| 5839 | // wrapWithOid wraps a Datum with a custom Oid. |
| 5840 | func wrapWithOid(d Datum, oid oid.Oid) Datum { |
| 5841 | switch v := d.(type) { |
| 5842 | case nil: |
| 5843 | return nil |
| 5844 | case *DInt: |
| 5845 | case *DString: |
| 5846 | case *DArray: |
| 5847 | case dNull, *DOidWrapper: |
| 5848 | panic(errors.AssertionFailedf("cannot wrap %T with an Oid", v)) |
| 5849 | default: |
| 5850 | // Currently only *DInt, *DString, *DArray are hooked up to work with |
| 5851 | // *DOidWrapper. To support another base Datum type, replace all type |
| 5852 | // assertions to that type with calls to functions like AsDInt and |
| 5853 | // MustBeDInt. |
| 5854 | panic(errors.AssertionFailedf("unsupported Datum type passed to wrapWithOid: %T", d)) |
| 5855 | } |
| 5856 | return &DOidWrapper{ |
| 5857 | Wrapped: d, |
| 5858 | Oid: oid, |
| 5859 | } |
| 5860 | } |
| 5861 | |
| 5862 | // UnwrapDOidWrapper exposes the wrapped datum from a *DOidWrapper. |
| 5863 | func UnwrapDOidWrapper(d Datum) Datum { |
no outgoing calls
no test coverage detected
searching dependent graphs…