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

Method getOutgoingEdgesFrom

src/db/queries.ts:2163–2180  ·  view source on GitHub ↗

* Outgoing edges for MANY source nodes in one query. * * The batch form of getOutgoingEdges. Building a nested outline needs * the `contains` edges of every container in a file at once; doing that one * source at a time is a query per symbol on files that have hundreds.

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

Source from the content-addressed store, hash-verified

2161 * source at a time is a query per symbol on files that have hundreds.
2162 */
2163 getOutgoingEdgesFrom(sourceIds: readonly string[], kinds?: EdgeKind[]): Edge[] {
2164 if (sourceIds.length === 0) return [];
2165 const unique = [...new Set(sourceIds)];
2166 const out: Edge[] = [];
2167 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
2168 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
2169 const placeholders = chunk.map(() => '?').join(',');
2170 let sql = `SELECT * FROM edges WHERE source IN (${placeholders})`;
2171 const params: string[] = [...chunk];
2172 if (kinds && kinds.length > 0) {
2173 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
2174 params.push(...kinds);
2175 }
2176 const rows = this.db.prepare(sql).all(...params) as EdgeRow[];
2177 for (const row of rows) out.push(rowToEdge(row));
2178 }
2179 return out;
2180 }
2181
2182 /**
2183 * Fan-in (total incoming edge count) for MANY nodes in one query.

Callers 12

routeRootsFunction · 0.45
buildMembersFunction · 0.45
buildFileFunction · 0.45
buildOutlineEntriesFunction · 0.45
repositoryMethodFunction · 0.45
buildStepsFunction · 0.45
fileScopeEdgesWithinFunction · 0.45
buildCallsFunction · 0.45
hierarchyEdgesFunction · 0.45
membersOfFunction · 0.45
buildDeadCodeReportFunction · 0.45
overrideCandidatesFunction · 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