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

Method getIncomingEdges

src/db/queries.ts:2142–2154  ·  view source on GitHub ↗

* Get incoming edges to a node. Kind must precede opaque source IDs: * file IDs sort before function IDs, so source-first ordering lets imports * displace actual calls in capped caller lists. Keep deterministic ties * without changing the target/kind index's established kind precedence.

(targetId: string, kinds?: EdgeKind[])

Source from the content-addressed store, hash-verified

2140 * without changing the target/kind index's established kind precedence.
2141 */
2142 getIncomingEdges(targetId: string, kinds?: EdgeKind[]): Edge[] {
2143 if (kinds && kinds.length > 0) {
2144 const sql = `SELECT * FROM edges WHERE target = ? AND kind IN (${kinds.map(() => '?').join(',')}) ORDER BY kind, source, line, col`;
2145 const rows = this.edgeKindStmt(sql).all(targetId, ...kinds) as EdgeRow[];
2146 return rows.map(rowToEdge);
2147 }
2148
2149 if (!this.stmts.getEdgesByTarget) {
2150 this.stmts.getEdgesByTarget = this.db.prepare('SELECT * FROM edges WHERE target = ? ORDER BY kind, source, line, col');
2151 }
2152 const rows = this.stmts.getEdgesByTarget.all(targetId) as EdgeRow[];
2153 return rows.map(rowToEdge);
2154 }
2155
2156 /**
2157 * Outgoing edges for MANY source nodes in one query.

Callers 15

fieldChannelEdgesFunction · 0.45
reactRenderEdgesFunction · 0.45
rnCrossPlatformEdgesFunction · 0.45
targetsOfFunction · 0.45
collectSynthLinksMethod · 0.45
containerOfMethod · 0.45
isUsageIsolatedMethod · 0.45
isPolymorphicSiblingMethod · 0.45
buildNodeFunction · 0.45

Calls 5

edgeKindStmtMethod · 0.95
mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected