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

Method Compare

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

Compare implements the Datum interface.

(ctx *EvalContext, other Datum)

Source from the content-addressed store, hash-verified

651
652// Compare implements the Datum interface.
653func (d *DInt) Compare(ctx *EvalContext, other Datum) int {
654 if other == DNull {
655 // NULL is less than any non-NULL value.
656 return 1
657 }
658 var v DInt
659 switch t := UnwrapDatum(ctx, other).(type) {
660 case *DInt:
661 v = *t
662 case *DFloat, *DDecimal:
663 return -t.Compare(ctx, d)
664 default:
665 panic(makeUnsupportedComparisonMessage(d, other))
666 }
667 if *d < v {
668 return -1
669 }
670 if *d > v {
671 return 1
672 }
673 return 0
674}
675
676// Prev implements the Datum interface.
677func (d *DInt) Prev(_ *EvalContext) (Datum, bool) {

Callers

nothing calls this directly

Calls 3

UnwrapDatumFunction · 0.85
CompareMethod · 0.65

Tested by

no test coverage detected