* Nodes whose name starts with `prefix`, by index range scan (a LIKE would * skip idx_nodes_name under SQLite's default case-insensitive LIKE).
(prefix: string, limit = 20)
| 1117 | * skip idx_nodes_name under SQLite's default case-insensitive LIKE). |
| 1118 | */ |
| 1119 | getNodesByNamePrefix(prefix: string, limit = 20): Node[] { |
| 1120 | if (!this.stmts.getNodesByNamePrefix) { |
| 1121 | this.stmts.getNodesByNamePrefix = this.db.prepare( |
| 1122 | 'SELECT * FROM nodes WHERE name >= ? AND name < ? ORDER BY name LIMIT ?' |
| 1123 | ); |
| 1124 | } |
| 1125 | const rows = this.stmts.getNodesByNamePrefix.all(prefix, prefix + '', limit) as NodeRow[]; |
| 1126 | return rows.map(rowToNode); |
| 1127 | } |
| 1128 | |
| 1129 | /** |
| 1130 | * Get nodes by exact qualified name match (uses idx_nodes_qualified_name index) |
no test coverage detected