MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / extract_f64

Function extract_f64

nodedb-query/src/msgpack_scan/aggregate_helpers.rs:31–37  ·  view source on GitHub ↗
(doc: &[u8], field: &str, expr: Option<&SqlExpr>)

Source from the content-addressed store, hash-verified

29/// Returns `None` when the field is absent or cannot be converted to f64.
30#[inline]
31pub fn extract_f64(doc: &[u8], field: &str, expr: Option<&SqlExpr>) -> Option<f64> {
32 if let Some(expr) = expr {
33 return value_ops::value_to_f64(&eval_expr(doc, expr)?, false);
34 }
35 let (start, _end) = extract_field(doc, 0, field)?;
36 read_f64(doc, start)
37}
38
39/// Extract a display string from `field`, or evaluate `expr` if provided.
40/// Returns `None` when the field is absent.

Callers 1

feedMethod · 0.50

Calls 4

value_to_f64Function · 0.85
extract_fieldFunction · 0.85
eval_exprFunction · 0.70
read_f64Function · 0.70

Tested by

no test coverage detected