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

Method iterateNodesByLanguageWithDecorator

src/db/queries.ts:1082–1091  ·  view source on GitHub ↗

* Stream nodes of one language whose `decorators` JSON array contains * `decorator`. The LIKE on the JSON text is a cheap index-free pre-filter * (a decorator name can appear as a substring of another), so callers must * still exact-check `node.decorators.includes(decorator)`. Exists so the

(language: Language, decorator: string)

Source from the content-addressed store, hash-verified

1080 * default heap on a 2M-node graph (#1212).
1081 */
1082 *iterateNodesByLanguageWithDecorator(language: Language, decorator: string): IterableIterator<Node> {
1083 // Fresh statement per call — an iterator holds an open cursor (see
1084 // iterateNodesByKind).
1085 const stmt = this.db.prepare(
1086 "SELECT * FROM nodes WHERE language = ? AND decorators LIKE '%' || ? || '%'"
1087 );
1088 for (const row of stmt.iterate(language, `"${decorator}"`)) {
1089 yield rowToNode(row as NodeRow);
1090 }
1091 }
1092
1093 /**
1094 * Distinct languages present in the files table. One indexed aggregate —

Callers 2

kotlinExpectActualEdgesFunction · 0.80

Calls 3

rowToNodeFunction · 0.85
prepareMethod · 0.65
iterateMethod · 0.65

Tested by

no test coverage detected