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

Method Compare

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

Compare implements the Datum interface.

(ctx *EvalContext, other Datum)

Source from the content-addressed store, hash-verified

2805
2806// Compare implements the Datum interface.
2807func (d *DJSON) Compare(ctx *EvalContext, other Datum) int {
2808 if other == DNull {
2809 // NULL is less than any non-NULL value.
2810 return 1
2811 }
2812 v, ok := UnwrapDatum(ctx, other).(*DJSON)
2813 if !ok {
2814 panic(makeUnsupportedComparisonMessage(d, other))
2815 }
2816 // No avenue for us to pass up this error here at the moment, but Compare
2817 // only errors for invalid encoded data.
2818 // TODO(justin): modify Compare to allow passing up errors.
2819 c, err := d.JSON.Compare(v.JSON)
2820 if err != nil {
2821 panic(err)
2822 }
2823 return c
2824}
2825
2826// Prev implements the Datum interface.
2827func (d *DJSON) Prev(_ *EvalContext) (Datum, bool) {

Callers

nothing calls this directly

Calls 3

UnwrapDatumFunction · 0.85
CompareMethod · 0.65

Tested by

no test coverage detected