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

Method getOutgoingEdges

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

2754 * (calls before imports/references), then break ties deterministically.
2755 */
2756 getOutgoingEdges(sourceId: string, kinds?: EdgeKind[], provenance?: string, limit?: number): Edge[] {
2757 if ((kinds && kinds.length > 0) || provenance || limit !== undefined) {
2758 let sql = 'SELECT * FROM edges WHERE source = ?';
2759 const params: (string | number)[] = [sourceId];
2760
2761 if (kinds && kinds.length > 0) {
2762 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
2763 params.push(...kinds);
2764 }
2765
2766 if (provenance) {
2767 sql += ' AND provenance = ?';
2768 params.push(provenance);
2769 }
2770
2771 sql += ' ORDER BY kind, target, line, col';
2772 if (limit !== undefined) {
2773 sql += ' LIMIT ?';
2774 params.push(Math.max(0, Math.floor(limit)));
2775 }
2776 const rows = this.edgeKindStmt(sql).all(...params) as EdgeRow[];
2777 return rows.map(rowToEdge);
2778 }
2779
2780 if (!this.stmts.getEdgesBySource) {
2781 this.stmts.getEdgesBySource = this.db.prepare('SELECT * FROM edges WHERE source = ? ORDER BY kind, target, line, col');
2782 }
2783 const rows = this.stmts.getEdgesBySource.all(sourceId) as EdgeRow[];
2784 return rows.map(rowToEdge);
2785 }
2786
2787 /**
2788 * Incoming edges to a node except `contains`: the edges that make their

Callers 15

createContextMethod · 0.45
supertypesOfMethod · 0.45
callableMembersOfMethod · 0.45
fnRefsOfFunction · 0.45
ancestorsOfFunction · 0.45
classReferencedAtFunction · 0.45
fieldChannelEdgesFunction · 0.45
reactRenderEdgesFunction · 0.45
flutterBuildEdgesFunction · 0.45
arkuiStateBuildEdgesFunction · 0.45
methodsOfFunction · 0.45
cppOverrideEdgesFunction · 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