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

Function extract_str_val

nodedb-query/src/msgpack_scan/aggregate.rs:260–268  ·  view source on GitHub ↗

Extract a string from a field or expression result.

(doc: &[u8], field: &str, expr: Option<&crate::expr::SqlExpr>)

Source from the content-addressed store, hash-verified

258
259/// Extract a string from a field or expression result.
260fn extract_str_val(doc: &[u8], field: &str, expr: Option<&crate::expr::SqlExpr>) -> Option<String> {
261 if let Some(expr) = expr {
262 return Some(value_ops::value_to_display_string(&eval_expr_on_doc(
263 doc, expr,
264 )?));
265 }
266 let (start, _end) = extract_field(doc, 0, field)?;
267 read_str(doc, start).map(|s| s.to_string())
268}
269
270/// Extract a field as `Value`. Uses direct msgpack→Value for scalars;
271/// falls back to full decode only for complex types.

Callers 1

compute_aggregate_binaryFunction · 0.85

Calls 5

value_to_display_stringFunction · 0.85
eval_expr_on_docFunction · 0.85
extract_fieldFunction · 0.85
to_stringMethod · 0.80
read_strFunction · 0.70

Tested by

no test coverage detected