Compare implements the Datum interface.
(ctx *EvalContext, other Datum)
| 651 | |
| 652 | // Compare implements the Datum interface. |
| 653 | func (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. |
| 677 | func (d *DInt) Prev(_ *EvalContext) (Datum, bool) { |
nothing calls this directly
no test coverage detected