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

Method getNodeRowsByRowid

src/db/queries.ts:2633–2649  ·  view source on GitHub ↗

Whole node rows for `rowids`, in that order; a rowid no longer present is skipped.

(rowids: readonly number[])

Source from the content-addressed store, hash-verified

2631
2632 /** Whole node rows for `rowids`, in that order; a rowid no longer present is skipped. */
2633 private getNodeRowsByRowid(rowids: readonly number[]): NodeRow[] {
2634 if (rowids.length === 0) return [];
2635 const byRowid = new Map<number, NodeRow>();
2636 for (let i = 0; i < rowids.length; i += SQLITE_PARAM_CHUNK_SIZE) {
2637 const chunk = rowids.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
2638 const rows = this.db
2639 .prepare(`SELECT rowid AS rowid_, nodes.* FROM nodes WHERE rowid IN (${chunk.map(() => '?').join(',')})`)
2640 .all(...chunk) as Array<NodeRow & { rowid_: number }>;
2641 for (const row of rows) byRowid.set(row.rowid_, row);
2642 }
2643 const out: NodeRow[] = [];
2644 for (const rowid of rowids) {
2645 const row = byRowid.get(rowid);
2646 if (row) out.push(row);
2647 }
2648 return out;
2649 }
2650
2651 // ===========================================================================
2652 // Edge Operations

Callers 1

Calls 7

mapMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
getMethod · 0.65
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected