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

Method getNodesByFiles

src/db/queries.ts:1370–1382  ·  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

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