(condition: Condition, hint: IndexHint)
| 224 | * @returns True if the condition is fully covered by the index. |
| 225 | */ |
| 226 | export function isConditionFullyCovered(condition: Condition, hint: IndexHint): boolean { |
| 227 | // Only simple conditions can be fully covered |
| 228 | const [operator] = condition; |
| 229 | |
| 230 | switch (operator) { |
| 231 | case "=": |
| 232 | case "<": |
| 233 | case "<=": |
| 234 | case ">": |
| 235 | case ">=": |
| 236 | case "in": |
| 237 | // These are fully covered if the hint matches the condition |
| 238 | return hint.condition === condition; |
| 239 | |
| 240 | case "startsWith": |
| 241 | case "contains": |
| 242 | // Full-text operations might have false positives, so we should |
| 243 | // still filter to be safe |
| 244 | return false; |
| 245 | |
| 246 | default: |
| 247 | return false; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Extract conditions that can't be satisfied by indexes. |
no outgoing calls
no test coverage detected