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

Function prepareNodeStatement

src/db/queries.ts:284–298  ·  view source on GitHub ↗
(db: SqliteDatabase, sql: string)

Source from the content-addressed store, hash-verified

282}
283
284function prepareNodeStatement(db: SqliteDatabase, sql: string): NodeStatement {
285 const stmt = db.prepare(sql);
286 const columns = stmt.rowsAsArrays();
287 const toNode = (columns ? arrayToNode(columns) : rowToNode) as (row: unknown) => Node;
288 return {
289 all: (...params) => (stmt.all(...params) as unknown[]).map(toNode),
290 get: (...params) => {
291 const row = stmt.get(...params);
292 return row === undefined ? undefined : toNode(row);
293 },
294 *iterate(...params) {
295 for (const row of stmt.iterate(...params)) yield toNode(row);
296 },
297 };
298}
299
300/**
301 * A search's `path:` and `name:` filters, lowercased once. The values of one

Callers 8

getNodeByIdMethod · 0.85
getNodesByFileAndNameMethod · 0.85
getNodesByFileMethod · 0.85
getNodesByKindMethod · 0.85
iterateNodesByKindMethod · 0.85
getNodesByNameMethod · 0.85
getNodesByLowerNameMethod · 0.85

Calls 6

arrayToNodeFunction · 0.85
mapMethod · 0.80
prepareMethod · 0.65
rowsAsArraysMethod · 0.65
allMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected