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

Function extract_value_bytes

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

Source from the content-addressed store, hash-verified

393}
394
395fn extract_value_bytes(
396 doc: &[u8],
397 field: &str,
398 expr: Option<&crate::expr::SqlExpr>,
399) -> Option<Vec<u8>> {
400 if let Some(expr) = expr {
401 let val = eval_expr_on_doc(doc, expr)?;
402 return nodedb_types::json_msgpack::value_to_msgpack(&val).ok();
403 }
404 let (start, end) = extract_field(doc, 0, field)?;
405 Some(doc[start..end].to_vec())
406}
407
408/// Check if msgpack bytes represent null. Msgpack null is the single byte 0xc0.
409fn value_bytes_are_null(bytes: &[u8]) -> bool {

Callers 1

compute_aggregate_binaryFunction · 0.85

Calls 5

eval_expr_on_docFunction · 0.85
value_to_msgpackFunction · 0.85
extract_fieldFunction · 0.85
okMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected