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

Function value_from_field

nodedb-query/src/msgpack_scan/aggregate.rs:280–289  ·  view source on GitHub ↗
(doc: &[u8], field: &str)

Source from the content-addressed store, hash-verified

278
279#[inline]
280fn value_from_field(doc: &[u8], field: &str) -> Option<Value> {
281 let (start, end) = extract_field(doc, 0, field)?;
282 // Fast path: scalar types (null, bool, int, float, string).
283 if let Some(v) = crate::msgpack_scan::reader::read_value(doc, start) {
284 return Some(v);
285 }
286 // Slow path: complex types (array, map, bin) — decode field bytes directly.
287 let field_bytes = &doc[start..end];
288 nodedb_types::json_msgpack::value_from_msgpack(field_bytes).ok()
289}
290
291/// Find min or max across docs by comparing raw field bytes.
292fn find_minmax(

Callers 2

compute_aggregate_binaryFunction · 0.85
extract_as_valueFunction · 0.85

Calls 4

extract_fieldFunction · 0.85
value_from_msgpackFunction · 0.85
read_valueFunction · 0.70
okMethod · 0.45

Tested by

no test coverage detected