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

Function bytes_to_binary_tuple

nodedb/src/data/executor/strict_format/encode.rs:14–21  ·  view source on GitHub ↗

Encode a `nodedb_types::Value::Object` as a Binary Tuple according to the schema. Accepts zerompk bytes (from planner) and decodes them internally. Missing nullable columns become NULL; missing non-nullable columns error.

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

Source from the content-addressed store, hash-verified

12/// Accepts zerompk bytes (from planner) and decodes them internally.
13/// Missing nullable columns become NULL; missing non-nullable columns error.
14pub fn bytes_to_binary_tuple(bytes: &[u8], schema: &StrictSchema) -> crate::Result<Vec<u8>> {
15 let value =
16 nodedb_types::value_from_msgpack(bytes).map_err(|e| crate::Error::Serialization {
17 format: "msgpack".to_string(),
18 detail: format!("zerompk decode: {e}"),
19 })?;
20 value_to_binary_tuple(&value, schema)
21}
22
23/// Encode a `nodedb_types::Value` as a Binary Tuple according to the schema.
24pub fn value_to_binary_tuple(value: &Value, schema: &StrictSchema) -> crate::Result<Vec<u8>> {

Callers 3

convert_to_strictMethod · 0.85
apply_point_putMethod · 0.85
tx_point_putMethod · 0.85

Calls 3

value_from_msgpackFunction · 0.85
value_to_binary_tupleFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected