Skip to main content

Module value_ops

Module value_ops 

Source
Expand description

Core value operations on nodedb_types::Value: comparison, coercion, truthiness.

Equivalent to json_ops.rs but operates on the internal Value type directly, avoiding the serde_json::Value intermediate. Used by expression evaluation, computed projections, and aggregate expression paths.

Functions§

coerced_eq
Check equality with type coercion.
compare_sort_values
Order of two non-NULL values for an ORDER BY over output rows (window ORDER BY, post-aggregate ORDER BY). Text orders by its bytes, so "10" sorts before "9". Booleans sort false first. Any other pair takes compare_values: numbers by their exact reading, NaN above every number. The caller places NULLs.
compare_values
Compare two Values with type coercion, for sorting and extremum selection (ORDER BY, MIN / MAX, GREATEST / LEAST, window frames).
involves_instant
Whether either side is a typed instant, so the pair compares by epoch microseconds through Value::partial_cmp_coerced (an ISO string on the other side is parsed).
is_truthy
Check if a Value is truthy (for boolean contexts).
numeric_order
Numeric order of a and b when both have a numeric reading (number, decimal, numeric string, bool). None when a side is not numeric. The order is total: NaN sorts above every number and equals NaN.
partial_compare_values
Compare two Values with type coercion, for a predicate.
sort_peers
Whether two values are peers under an ORDER BY: both NULL, or both non-NULL and ordered Equal by compare_sort_values. NaN is a peer of NaN.
to_value_number
Convert an f64 to a Value, preferring integer representation.
value_to_display_string
Convert a Value to a display string.
value_to_f64
Coerce a Value to f64.