* Checks if an OR expression can be optimized
(expression: BasicExpression, collection: CollectionLike<T, TKey>)
| 718 | * Checks if an OR expression can be optimized |
| 719 | */ |
| 720 | function canOptimizeOrExpression< |
| 721 | T extends object, |
| 722 | TKey extends string | number, |
| 723 | >(expression: BasicExpression, collection: CollectionLike<T, TKey>): boolean { |
| 724 | if (expression.type !== `func` || expression.args.length < 2) { |
| 725 | return false |
| 726 | } |
| 727 | |
| 728 | // Every disjunct must be optimizable, otherwise the union would miss |
| 729 | // rows matched only by the non-optimizable disjuncts |
| 730 | return expression.args.every((arg) => canOptimizeExpression(arg, collection)) |
| 731 | } |
| 732 | |
| 733 | /** |
| 734 | * Optimizes IN array expressions |
no test coverage detected