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

Method iterateNodesByKind

src/db/queries.ts:1056–1063  ·  view source on GitHub ↗

* Stream every node of a kind one at a time (lazy) instead of materializing * them all like getNodesByKind. For unbounded kinds (`function`, * `method`) on a symbol-dense project the full array is gigabytes; the * dynamic-edge synthesizers only scan-and-filter, so they iterate to ke

(kind: NodeKind)

Source from the content-addressed store, hash-verified

1054 * memory O(1) in the node count rather than O(nodes) (#610).
1055 */
1056 *iterateNodesByKind(kind: NodeKind): IterableIterator<Node> {
1057 // Fresh statement per call (not a cached one): an iterator holds an open
1058 // cursor, so a shared statement would conflict across overlapping scans.
1059 const stmt = this.db.prepare('SELECT * FROM nodes WHERE kind = ?');
1060 for (const row of stmt.iterate(kind)) {
1061 yield rowToNode(row as NodeRow);
1062 }
1063 }
1064
1065 /**
1066 * Get all nodes in the database

Callers

nothing calls this directly

Calls 3

rowToNodeFunction · 0.85
prepareMethod · 0.65
iterateMethod · 0.65

Tested by

no test coverage detected