MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getNodesByFiles

Method getNodesByFiles

src/db/queries.ts:1372–1384  ·  view source on GitHub ↗

* Get all nodes in several files at once — one chunked `IN` query rather than * one getNodesByFile per file (#1975).

(filePaths: readonly string[])

Source from the content-addressed store, hash-verified

1370 * one {@link getNodesByFile} per file (#1975).
1371 */
1372 getNodesByFiles(filePaths: readonly string[]): Node[] {
1373 const unique = [...new Set(filePaths)];
1374 const out: Node[] = [];
1375 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
1376 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
1377 const placeholders = chunk.map(() => '?').join(',');
1378 const rows = this.db
1379 .prepare(`SELECT * FROM nodes WHERE file_path IN (${placeholders})`)
1380 .all(...chunk) as NodeRow[];
1381 for (const row of rows) out.push(rowToNode(row));
1382 }
1383 return out;
1384 }
1385
1386 /**
1387 * Find the file that holds the densest concentration of the project's

Callers 5

syncMethod · 0.80
getNodesInFilesMethod · 0.80
manualMockNamesMethod · 0.80
classExpressionsMethod · 0.80

Calls 6

rowToNodeFunction · 0.85
mapMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected