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

Function wrapWithOid

pkg/sql/sem/tree/datum.go:3692–3712  ·  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

3690
3691// wrapWithOid wraps a Datum with a custom Oid.
3692func wrapWithOid(d Datum, oid oid.Oid) Datum {
3693 switch v := d.(type) {
3694 case nil:
3695 return nil
3696 case *DInt:
3697 case *DString:
3698 case *DArray:
3699 case dNull, *DOidWrapper:
3700 panic(errors.AssertionFailedf("cannot wrap %T with an Oid", v))
3701 default:
3702 // Currently only *DInt, *DString, *DArray are hooked up to work with
3703 // *DOidWrapper. To support another base Datum type, replace all type
3704 // assertions to that type with calls to functions like AsDInt and
3705 // MustBeDInt.
3706 panic(errors.AssertionFailedf("unsupported Datum type passed to wrapWithOid: %T", d))
3707 }
3708 return &DOidWrapper{
3709 Wrapped: d,
3710 Oid: oid,
3711 }
3712}
3713
3714// UnwrapDatum returns the base Datum type for a provided datum, stripping
3715// an *DOidWrapper if present. This is useful for cases like type switches,

Callers 5

PrevMethod · 0.85
NextMethod · 0.85
MaxMethod · 0.85
MinMethod · 0.85
NewDNameFromDStringFunction · 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…