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)
| 12 | /// Accepts zerompk bytes (from planner) and decodes them internally. |
| 13 | /// Missing nullable columns become NULL; missing non-nullable columns error. |
| 14 | pub 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. |
| 24 | pub fn value_to_binary_tuple(value: &Value, schema: &StrictSchema) -> crate::Result<Vec<u8>> { |
no test coverage detected