MCPcopy Create free account
hub / github.com/douglance/devsql / flatten_usage_columns

Function flatten_usage_columns

crates/ccql/src/sql/composite_storage.rs:359–365  ·  view source on GitHub ↗

Inject flattened `model` / `usage_*` columns for assistant rows. Values come from `message.model` and `message.usage.*`. A column is only added when the source value exists and the key is not already present at the top level of the record (existing JSON keys always win).

(json: &JsonValue, map: &mut BTreeMap<String, Value>)

Source from the content-addressed store, hash-verified

357/// added when the source value exists and the key is not already present at
358/// the top level of the record (existing JSON keys always win).
359fn flatten_usage_columns(json: &JsonValue, map: &mut BTreeMap<String, Value>) {
360 for (key, value) in flattened_usage_fields(json) {
361 if !map.contains_key(key) {
362 map.insert(key.to_string(), json_value_to_glue_value(value));
363 }
364 }
365}
366
367/// Convert a todo JSON object to a DataRow
368fn todo_json_to_data_row(

Callers 1

Calls 2

flattened_usage_fieldsFunction · 0.85
json_value_to_glue_valueFunction · 0.85

Tested by

no test coverage detected