* 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[])
| 3581 | * probe over `idx_unresolved_from_node`. |
| 3582 | */ |
| 3583 | getUnresolvedReferencesFromNodes(nodeIds: Iterable<string>, kinds: readonly string[]): UnresolvedReference[] { |
| 3584 | const unique = [...new Set(nodeIds)]; |
| 3585 | const found: UnresolvedReference[] = []; |
| 3586 | if (unique.length === 0 || kinds.length === 0) return found; |
| 3587 | const kindPlaceholders = kinds.map(() => '?').join(','); |
| 3588 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3589 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3590 | const placeholders = chunk.map(() => '?').join(','); |
| 3591 | const rows = this.db |
| 3592 | .prepare( |
| 3593 | `SELECT * FROM unresolved_refs |
| 3594 | WHERE from_node_id IN (${placeholders}) |
| 3595 | AND reference_kind IN (${kindPlaceholders})` |
| 3596 | ) |
| 3597 | .all(...chunk, ...kinds) as UnresolvedRefRow[]; |
| 3598 | for (const row of rows) { |
| 3599 | found.push({ |
| 3600 | fromNodeId: row.from_node_id, |
| 3601 | referenceName: row.reference_name, |
| 3602 | referenceKind: row.reference_kind as EdgeKind, |
| 3603 | line: row.line, |
| 3604 | column: row.col, |
| 3605 | filePath: row.file_path, |
| 3606 | language: row.language as Language, |
| 3607 | rowId: row.id, |
| 3608 | }); |
| 3609 | } |
| 3610 | } |
| 3611 | return found; |
| 3612 | } |
| 3613 | |
| 3614 | /** |
| 3615 | * Find all edges where both source and target are in the given node set. |