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

Method getIncomingEdgesTo

src/db/queries.ts:2862–2879  ·  view source on GitHub ↗

* Incoming edges for MANY target nodes in one query — the mirror of * getOutgoingEdgesFrom. Needed wherever a whole file's inbound edges * are wanted at once ("which files import anything in this one?").

(targetIds: readonly string[], kinds?: EdgeKind[])

Source from the content-addressed store, hash-verified

2860 * are wanted at once ("which files import anything in this one?").
2861 */
2862 getIncomingEdgesTo(targetIds: readonly string[], kinds?: EdgeKind[]): Edge[] {
2863 if (targetIds.length === 0) return [];
2864 const unique = [...new Set(targetIds)];
2865 const out: Edge[] = [];
2866 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
2867 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
2868 const placeholders = chunk.map(() => '?').join(',');
2869 let sql = `SELECT * FROM edges WHERE target IN (${placeholders})`;
2870 const params: string[] = [...chunk];
2871 if (kinds && kinds.length > 0) {
2872 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
2873 params.push(...kinds);
2874 }
2875 const rows = this.db.prepare(sql).all(...params) as EdgeRow[];
2876 for (const row of rows) out.push(rowToEdge(row));
2877 }
2878 return out;
2879 }
2880
2881 /**
2882 * Fan-out (total outgoing edge count) for MANY nodes in one query — the

Callers 8

buildFileFunction · 0.45
buildScreensFunction · 0.45
attributeFunction · 0.45
mentionsOfFunction · 0.45
renderParentsFunction · 0.45
hierarchyEdgesFunction · 0.45
countImplementersFunction · 0.45
containersOfFunction · 0.45

Calls 6

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

Tested by

no test coverage detected