MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / wrapWithOid

Function wrapWithOid

pkg/sql/sem/tree/datum.go:5840–5860  ·  view source on GitHub ↗

wrapWithOid wraps a Datum with a custom Oid.

(d Datum, oid oid.Oid)

Source from the content-addressed store, hash-verified

5838
5839// wrapWithOid wraps a Datum with a custom Oid.
5840func 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.
5863func UnwrapDOidWrapper(d Datum) Datum {

Callers 6

PrevMethod · 0.85
NextMethod · 0.85
MaxMethod · 0.85
MinMethod · 0.85
NewDNameFromDStringFunction · 0.85
NewDRefCursorFromDStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…