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

Method getNodeRowsByRowid

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

2615
2616 /** Whole node rows for `rowids`, in that order; a rowid no longer present is skipped. */
2617 private getNodeRowsByRowid(rowids: readonly number[]): NodeRow[] {
2618 if (rowids.length === 0) return [];
2619 const byRowid = new Map<number, NodeRow>();
2620 for (let i = 0; i < rowids.length; i += SQLITE_PARAM_CHUNK_SIZE) {
2621 const chunk = rowids.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
2622 const rows = this.db
2623 .prepare(`SELECT rowid AS rowid_, nodes.* FROM nodes WHERE rowid IN (${chunk.map(() => '?').join(',')})`)
2624 .all(...chunk) as Array<NodeRow & { rowid_: number }>;
2625 for (const row of rows) byRowid.set(row.rowid_, row);
2626 }
2627 const out: NodeRow[] = [];
2628 for (const rowid of rowids) {
2629 const row = byRowid.get(rowid);
2630 if (row) out.push(row);
2631 }
2632 return out;
2633 }
2634
2635 // ===========================================================================
2636 // 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