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

Method getOutgoingEdges

src/db/queries.ts:2740–2769  ·  view source on GitHub ↗

* Get outgoing edges from a node. Preserve the source/kind index order * (calls before imports/references), then break ties deterministically.

(sourceId: string, kinds?: EdgeKind[], provenance?: string, limit?: number)

Source from the content-addressed store, hash-verified

2738 * (calls before imports/references), then break ties deterministically.
2739 */
2740 getOutgoingEdges(sourceId: string, kinds?: EdgeKind[], provenance?: string, limit?: number): Edge[] {
2741 if ((kinds && kinds.length > 0) || provenance || limit !== undefined) {
2742 let sql = 'SELECT * FROM edges WHERE source = ?';
2743 const params: (string | number)[] = [sourceId];
2744
2745 if (kinds && kinds.length > 0) {
2746 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
2747 params.push(...kinds);
2748 }
2749
2750 if (provenance) {
2751 sql += ' AND provenance = ?';
2752 params.push(provenance);
2753 }
2754
2755 sql += ' ORDER BY kind, target, line, col';
2756 if (limit !== undefined) {
2757 sql += ' LIMIT ?';
2758 params.push(Math.max(0, Math.floor(limit)));
2759 }
2760 const rows = this.edgeKindStmt(sql).all(...params) as EdgeRow[];
2761 return rows.map(rowToEdge);
2762 }
2763
2764 if (!this.stmts.getEdgesBySource) {
2765 this.stmts.getEdgesBySource = this.db.prepare('SELECT * FROM edges WHERE source = ? ORDER BY kind, target, line, col');
2766 }
2767 const rows = this.stmts.getEdgesBySource.all(sourceId) as EdgeRow[];
2768 return rows.map(rowToEdge);
2769 }
2770
2771 /**
2772 * Get incoming edges to a node. Kind must precede opaque source IDs:

Callers 15

createContextMethod · 0.45
supertypesOfMethod · 0.45
callableMembersOfMethod · 0.45
fieldChannelEdgesFunction · 0.45
reactRenderEdgesFunction · 0.45
flutterBuildEdgesFunction · 0.45
arkuiStateBuildEdgesFunction · 0.45
methodsOfFunction · 0.45
cppOverrideEdgesFunction · 0.45
ownMethodsFunction · 0.45
embedsFunction · 0.45
interfaceOverrideEdgesFunction · 0.45

Calls 6

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

Tested by

no test coverage detected