Rindle docs and package mapSkip to main content

compare_values

Function compare_values 

pub fn compare_values(a: Value<'_>, b: Value<'_>) -> Ordering
Expand description

SORT / identity-of-storage comparison. null == null (Equal). Total order: null < everything. Floats use total_cmp (NOT subtraction — avoids the JS a - b overflow/NaN trap). Strings/json compare bytewise == SQLite BINARY collation. Int/Float are the same JS number domain and compare by widening to f64 (JS has no int/float split — the distinction is a Rust-port artifact, so a mixed pair is not a type error). It arises in practice when an AST paging bound — integral literals lower to Int — is sorted against a Number column that vends as Float (e.g. a SQLite leaf). A pair of genuinely different JS types (number vs string, …) is still a builder bug and panics, mirroring the JS oracle’s compareValues throw.