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

Function value_as_f64

nodedb-client/src/graph_dsl.rs:85–88  ·  view source on GitHub ↗

Coerce a result cell to `f64`, accepting either a native numeric value or a text-encoded number (the pgwire transport renders floats as text).

(v: &Value)

Source from the content-addressed store, hash-verified

83/// Coerce a result cell to `f64`, accepting either a native numeric value or a
84/// text-encoded number (the pgwire transport renders floats as text).
85fn value_as_f64(v: &Value) -> Option<f64> {
86 v.as_f64()
87 .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
88}
89
90#[cfg(test)]
91mod tests {

Callers

nothing calls this directly

Calls 4

as_f64Method · 0.45
as_strMethod · 0.45
okMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected