Every CONNECTS_TO edge as " -> ( )". */
| 2554 | |
| 2555 | /* Every CONNECTS_TO edge as "<source file> <source> -> <target> (<key>)". */ |
| 2556 | static char *gpf_connects(const GpfFile *files, int nfiles) { |
| 2557 | GpfProj lp; |
| 2558 | cbm_store_t *store = gpf_index_files(&lp, files, nfiles); |
| 2559 | char *out = NULL; |
| 2560 | if (store) { |
| 2561 | sqlite3_stmt *st = NULL; |
| 2562 | const char *sql = |
| 2563 | "SELECT coalesce((SELECT group_concat(x, char(10)) FROM (SELECT s.file_path || ' ' || " |
| 2564 | "s.name || ' -> ' || t.name || ' (' || json_extract(e.properties,'$.key') || ')' AS x " |
| 2565 | "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON t.id=e.target_id WHERE " |
| 2566 | "e.project=?1 AND e.type='CONNECTS_TO' ORDER BY x)), '')"; |
| 2567 | if (sqlite3_prepare_v2(cbm_store_get_db(store), sql, -1, &st, NULL) == SQLITE_OK) { |
| 2568 | sqlite3_bind_text(st, 1, lp.project, -1, SQLITE_STATIC); |
| 2569 | if (sqlite3_step(st) == SQLITE_ROW) { |
| 2570 | out = strdup((const char *)sqlite3_column_text(st, 0)); |
| 2571 | } |
| 2572 | } |
| 2573 | sqlite3_finalize(st); |
| 2574 | } |
| 2575 | gpf_cleanup(&lp, store); |
| 2576 | return out; |
| 2577 | } |
| 2578 | |
| 2579 | /* A service address in a container's environment CONNECTS_TO the Service it |
| 2580 | * names: `svc:port`, a URL's host, `<svc>.<ns>.svc...`, a bare name on an |
no test coverage detected