* getUnresolvedReferencesFrom for many nodes at once, limited to * `kinds`: a Go type's embeddings of types outside the index, say. Chunked * probe over `idx_unresolved_from_node`.
(nodeIds: Iterable<string>, kinds: readonly string[])
| 3685 | * probe over `idx_unresolved_from_node`. |
| 3686 | */ |
| 3687 | getUnresolvedReferencesFromNodes(nodeIds: Iterable<string>, kinds: readonly string[]): UnresolvedReference[] { |
| 3688 | const unique = [...new Set(nodeIds)]; |
| 3689 | const found: UnresolvedReference[] = []; |
| 3690 | if (unique.length === 0 || kinds.length === 0) return found; |
| 3691 | const kindPlaceholders = kinds.map(() => '?').join(','); |
| 3692 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3693 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3694 | const placeholders = chunk.map(() => '?').join(','); |
| 3695 | const rows = this.db |
| 3696 | .prepare( |
| 3697 | `SELECT * FROM unresolved_refs |
| 3698 | WHERE from_node_id IN (${placeholders}) |
| 3699 | AND reference_kind IN (${kindPlaceholders})` |
| 3700 | ) |
| 3701 | .all(...chunk, ...kinds) as UnresolvedRefRow[]; |
| 3702 | for (const row of rows) { |
| 3703 | found.push({ |
| 3704 | fromNodeId: row.from_node_id, |
| 3705 | referenceName: row.reference_name, |
| 3706 | referenceKind: row.reference_kind as EdgeKind, |
| 3707 | line: row.line, |
| 3708 | column: row.col, |
| 3709 | filePath: row.file_path, |
| 3710 | language: row.language as Language, |
| 3711 | rowId: row.id, |
| 3712 | }); |
| 3713 | } |
| 3714 | } |
| 3715 | return found; |
| 3716 | } |
| 3717 | |
| 3718 | /** |
| 3719 | * Find all edges where both source and target are in the given node set. |