use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method startAfterWithFilterQueryBound.
@Test
public void startAfterWithFilterQueryBound() {
Target target = query("c").filter(filter("a", ">=", "a1")).filter(filter("b", "==", "b1")).orderBy(orderBy("a")).orderBy(orderBy("b")).startAt(bound(/* inclusive= */
false, "a2", "b1")).toTarget();
FieldIndex index = fieldIndex("c", "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, false, "a2", "b1");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, false, blob(), "b1");
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method startAtWithFilterQueryBound.
@Test
public void startAtWithFilterQueryBound() {
// Tests that the startAt and the filter get merged to form a narrow bound
Target target = query("c").filter(filter("a", ">=", "a1")).filter(filter("b", "==", "b1")).orderBy(orderBy("a")).orderBy(orderBy("b")).startAt(bound(/* inclusive= */
true, "a1", "b1")).toTarget();
FieldIndex index = fieldIndex("c", "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "a1", "b1");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, false, blob(), "b1");
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method endAtQueryBound.
@Test
public void endAtQueryBound() {
Target target = query("c").orderBy(orderBy("foo")).endAt(bound(/* inclusive= */
true, "bar")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
assertNull(lowerBound);
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, true, "bar");
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method startAtQueryBound.
@Test
public void startAtQueryBound() {
Target target = query("c").orderBy(orderBy("foo")).startAt(bound(/* inclusive= */
true, "bar")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "bar");
Bound upperBound = target.getUpperBound(index);
assertNull(upperBound);
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method endBeforeWithFilterQueryBound.
@Test
public void endBeforeWithFilterQueryBound() {
Target target = query("c").filter(filter("a", "<=", "a2")).filter(filter("b", "==", "b2")).orderBy(orderBy("a")).orderBy(orderBy("b")).endAt(bound(/* inclusive= */
false, "a1", "b1")).toTarget();
FieldIndex index = fieldIndex("c", "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "", "b2");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, false, "a1", "b1");
}
Aggregations