Convert a todo JSON object to a DataRow
(
json: &JsonValue,
source_file: &str,
workspace_id: &str,
agent_id: &str,
)
| 366 | |
| 367 | /// Convert a todo JSON object to a DataRow |
| 368 | fn todo_json_to_data_row( |
| 369 | json: &JsonValue, |
| 370 | source_file: &str, |
| 371 | workspace_id: &str, |
| 372 | agent_id: &str, |
| 373 | ) -> DataRow { |
| 374 | let mut map = BTreeMap::new(); |
| 375 | |
| 376 | map.insert( |
| 377 | "_source_file".to_string(), |
| 378 | Value::Str(source_file.to_string()), |
| 379 | ); |
| 380 | map.insert( |
| 381 | "_workspace_id".to_string(), |
| 382 | Value::Str(workspace_id.to_string()), |
| 383 | ); |
| 384 | map.insert("_agent_id".to_string(), Value::Str(agent_id.to_string())); |
| 385 | |
| 386 | if let JsonValue::Object(obj) = json { |
| 387 | for (key, value) in obj { |
| 388 | map.insert(key.clone(), json_value_to_glue_value(value)); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | DataRow::Map(map) |
| 393 | } |
| 394 | |
| 395 | /// Convert a codex jhistory JSON object to a normalized DataRow |
| 396 | fn jhistory_json_to_data_row(json: &JsonValue) -> Option<DataRow> { |
no test coverage detected