Skip to content

Commit ef1e42e

Browse files
committed
Remove classes for individual function types
1 parent db9ee0a commit ef1e42e

File tree

4 files changed

+1156
-2439
lines changed

4 files changed

+1156
-2439
lines changed

packages/firestore/src/core/pipeline-util.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ import {
2424
andFunction,
2525
orFunction,
2626
Ordering,
27-
And,
2827
lt,
2928
gt,
3029
lte,
3130
gte,
32-
eq,
33-
Or
31+
eq
3432
} from '../lite-api/expressions';
3533
import { Pipeline } from '../lite-api/pipeline';
3634
import { doc } from '../lite-api/reference';
@@ -61,9 +59,9 @@ export function toPipelineBooleanExpr(f: FilterInternal): BooleanExpr {
6159
const field = Field.of(f.field.toString());
6260
if (isNanValue(f.value)) {
6361
if (f.op === Operator.EQUAL) {
64-
return andFunction(field.exists(), field.isNaN());
62+
return andFunction(field.exists(), field.isNan());
6563
} else {
66-
return andFunction(field.exists(), not(field.isNaN()));
64+
return andFunction(field.exists(), not(field.isNan()));
6765
}
6866
} else if (isNullValue(f.value)) {
6967
if (f.op === Operator.EQUAL) {
@@ -249,11 +247,11 @@ function whereConditionsFromCursor(
249247
const filterFunc = position === 'before' ? lt : gt;
250248
const filterInclusiveFunc = position === 'before' ? lte : gte;
251249

252-
const orConditions = [];
250+
const orConditions: BooleanExpr[] = [];
253251
for (let i = 1; i <= orderings.length; i++) {
254252
const cursorSubset = cursors.slice(0, i);
255253

256-
const conditions = cursorSubset.map((cursor, index) => {
254+
const conditions: BooleanExpr[] = cursorSubset.map((cursor, index) => {
257255
if (index < cursorSubset.length - 1) {
258256
return eq(orderings[index].expr as Field, cursor);
259257
} else if (!!bound.inclusive && i === orderings.length) {
@@ -266,13 +264,19 @@ function whereConditionsFromCursor(
266264
if (conditions.length === 1) {
267265
orConditions.push(conditions[0]);
268266
} else {
269-
orConditions.push(new And(conditions));
267+
orConditions.push(
268+
andFunction(conditions[0], conditions[1], ...conditions.slice(2))
269+
);
270270
}
271271
}
272272

273273
if (orConditions.length === 1) {
274274
return orConditions[0];
275275
} else {
276-
return new Or(orConditions);
276+
return orFunction(
277+
orConditions[0],
278+
orConditions[1],
279+
...orConditions.slice(2)
280+
);
277281
}
278282
}

0 commit comments

Comments
 (0)