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

Function binary_tuple_to_json

nodedb/src/data/executor/strict_format/decode.rs:74–92  ·  view source on GitHub ↗

Decode a Binary Tuple to a JSON object using the schema (for pgwire output).

(
    tuple_bytes: &[u8],
    schema: &StrictSchema,
)

Source from the content-addressed store, hash-verified

72
73/// Decode a Binary Tuple to a JSON object using the schema (for pgwire output).
74pub fn binary_tuple_to_json(
75 tuple_bytes: &[u8],
76 schema: &StrictSchema,
77) -> Option<serde_json::Value> {
78 // Delegate to binary_tuple_to_value (which handles version-aware decoding)
79 // then convert Value → JSON.
80 let val = binary_tuple_to_value(tuple_bytes, schema)?;
81 match val {
82 Value::Object(map) => {
83 let mut obj = serde_json::Map::with_capacity(map.len());
84 for col in &schema.columns {
85 let v = map.get(&col.name).unwrap_or(&Value::Null);
86 obj.insert(col.name.clone(), value_to_json(v));
87 }
88 Some(serde_json::Value::Object(obj))
89 }
90 _ => None,
91 }
92}

Callers 10

execute_bulk_updateMethod · 0.85
build_source_join_mapMethod · 0.85
execute_mergeMethod · 0.85
decode_scanned_documentFunction · 0.85
execute_point_updateMethod · 0.85
roundtrip_via_valueFunction · 0.85
nullable_field_omittedFunction · 0.85

Calls 6

binary_tuple_to_valueFunction · 0.85
value_to_jsonFunction · 0.70
lenMethod · 0.45
getMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45

Tested by 2

roundtrip_via_valueFunction · 0.68
nullable_field_omittedFunction · 0.68