PickFromTuple picks the greatest (or least value) from a tuple.
(ctx *EvalContext, greatest bool, args Datums)
| 5366 | |
| 5367 | // PickFromTuple picks the greatest (or least value) from a tuple. |
| 5368 | func PickFromTuple(ctx *EvalContext, greatest bool, args Datums) (Datum, error) { |
| 5369 | g := args[0] |
| 5370 | // Pick a greater (or smaller) value. |
| 5371 | for _, d := range args[1:] { |
| 5372 | var eval Datum |
| 5373 | var err error |
| 5374 | if greatest { |
| 5375 | eval, err = evalComparison(ctx, LT, g, d) |
| 5376 | } else { |
| 5377 | eval, err = evalComparison(ctx, LT, d, g) |
| 5378 | } |
| 5379 | if err != nil { |
| 5380 | return nil, err |
| 5381 | } |
| 5382 | if eval == DBoolTrue || |
| 5383 | (eval == DNull && g == DNull) { |
| 5384 | g = d |
| 5385 | } |
| 5386 | } |
| 5387 | return g, nil |
| 5388 | } |
| 5389 | |
| 5390 | //// CallbackValueGenerator is a ValueGenerator that calls a supplied callback for |
| 5391 | //// producing the values. To be used with |
nothing calls this directly
no test coverage detected
searching dependent graphs…