Read a msgpack value at [start..end) as a display string.
(bytes: &[u8], start: usize, end: usize)
| 172 | |
| 173 | /// Read a msgpack value at [start..end) as a display string. |
| 174 | fn read_value_as_string(bytes: &[u8], start: usize, end: usize) -> String { |
| 175 | use nodedb_query::msgpack_scan::reader; |
| 176 | if let Some(s) = reader::read_str(bytes, start) { |
| 177 | return s.to_string(); |
| 178 | } |
| 179 | if let Some(i) = reader::read_i64(bytes, start) { |
| 180 | return i.to_string(); |
| 181 | } |
| 182 | if let Some(f) = reader::read_f64(bytes, start) { |
| 183 | return f.to_string(); |
| 184 | } |
| 185 | if let Some(b) = reader::read_bool(bytes, start) { |
| 186 | return b.to_string(); |
| 187 | } |
| 188 | if reader::read_null(bytes, start) { |
| 189 | return String::new(); |
| 190 | } |
| 191 | // Complex value — transcode slice to JSON string. |
| 192 | nodedb_types::msgpack_to_json_string(&bytes[start..end]).unwrap_or_default() |
| 193 | } |
| 194 | |
| 195 | /// Compute a single aggregate over a group of msgpack rows. |
| 196 | fn compute_aggregate(op: &str, field: &str, rows: &[&[u8]]) -> AggValue { |
no test coverage detected