Compare implements the Datum interface.
(ctx *EvalContext, other Datum)
| 2805 | |
| 2806 | // Compare implements the Datum interface. |
| 2807 | func (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. |
| 2827 | func (d *DJSON) Prev(_ *EvalContext) (Datum, bool) { |
nothing calls this directly
no test coverage detected