* Whether a range predicate on this operand would use an index ordering that * differs from the WHERE evaluator's relational operators, so an index range * lookup could omit genuine matches that re-filtering cannot recover. * * The evaluator compares with JS relational operators (extended with
( value: unknown, collection: CollectionLike<any, any>, )
| 152 | * cases handled by re-filtering ({@link isExactComparisonValue}). |
| 153 | */ |
| 154 | function isRangeOrderingDivergent( |
| 155 | value: unknown, |
| 156 | collection: CollectionLike<any, any>, |
| 157 | ): boolean { |
| 158 | switch (typeof value) { |
| 159 | case `number`: |
| 160 | case `bigint`: |
| 161 | case `boolean`: |
| 162 | return false |
| 163 | case `string`: |
| 164 | return usesLocaleStringSort(collection) |
| 165 | case `object`: { |
| 166 | if (value === null) return false |
| 167 | // Dates order consistently with the evaluator: valid Dates by time, and |
| 168 | // invalid Dates as the greatest value under PostgreSQL float semantics. |
| 169 | return !(value instanceof Date) |
| 170 | } |
| 171 | default: |
| 172 | return false |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Whether a range predicate (gt/gte/lt/lte) on this operand can be safely |
no test coverage detected