| 292 | #define AA_CALLISH_TYPES "'CALLS','CALL_REFERENCE','USAGE','HTTP_CALLS','ASYNC_CALLS'" |
| 293 | |
| 294 | static void aa_add_conn_rows(yyjson_mut_doc *doc, yyjson_mut_val *parent, sqlite3_stmt *st, |
| 295 | cbm_store_t *store, const char *project) { |
| 296 | yyjson_mut_val *items = yyjson_mut_arr(doc); |
| 297 | while (sqlite3_step(st) == SQLITE_ROW) { |
| 298 | yyjson_mut_val *row = yyjson_mut_obj(doc); |
| 299 | yyjson_mut_obj_add_strcpy(doc, row, "type", (const char *)sqlite3_column_text(st, 0)); |
| 300 | yyjson_mut_obj_add_int(doc, row, "id", sqlite3_column_int64(st, 1)); |
| 301 | yyjson_mut_obj_add_strcpy(doc, row, "label", (const char *)sqlite3_column_text(st, 2)); |
| 302 | yyjson_mut_obj_add_strcpy(doc, row, "name", (const char *)sqlite3_column_text(st, 3)); |
| 303 | const char *file = (const char *)sqlite3_column_text(st, 4); |
| 304 | if (file) |
| 305 | yyjson_mut_obj_add_strcpy(doc, row, "file_path", file); |
| 306 | int line = sqlite3_column_int(st, 5); |
| 307 | if (line > 0) |
| 308 | yyjson_mut_obj_add_int(doc, row, "start_line", line); |
| 309 | const char *qn = (const char *)sqlite3_column_text(st, 6); |
| 310 | if (qn) |
| 311 | yyjson_mut_obj_add_strcpy(doc, row, "qualified_name", qn); |
| 312 | if (file && store) { |
| 313 | int region = cbm_layout_region_for_file(store, project, file, NULL); |
| 314 | if (region >= 0) |
| 315 | yyjson_mut_obj_add_int(doc, row, "region", region); |
| 316 | } |
| 317 | yyjson_mut_arr_append(items, row); |
| 318 | } |
| 319 | yyjson_mut_obj_add_val(doc, parent, "items", items); |
| 320 | } |
| 321 | |
| 322 | /* callers (inbound=true) or callees of `id`, with totals and pagination. */ |
| 323 | static void aa_add_connections(yyjson_mut_doc *doc, yyjson_mut_val *root, struct sqlite3 *db, |
no test coverage detected