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

Method Compare

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

Compare implements the Datum interface.

(ctx *EvalContext, other Datum)

Source from the content-addressed store, hash-verified

1806
1807// Compare implements the Datum interface.
1808func (d *DDate) Compare(ctx *EvalContext, other Datum) int {
1809 if other == DNull {
1810 // NULL is less than any non-NULL value.
1811 return 1
1812 }
1813 var v DDate
1814 switch t := UnwrapDatum(ctx, other).(type) {
1815 case *DDate:
1816 v = *t
1817 case *DTimestamp, *DTimestampTZ:
1818 return compareTimestamps(ctx, d, other)
1819 default:
1820 panic(makeUnsupportedComparisonMessage(d, other))
1821 }
1822 return d.Date.Compare(v.Date)
1823}
1824
1825var (
1826 epochDate, _ = pgdate.MakeDateFromPGEpoch(0)

Callers

nothing calls this directly

Calls 4

UnwrapDatumFunction · 0.85
compareTimestampsFunction · 0.85
CompareMethod · 0.65

Tested by

no test coverage detected