Skip to content

Commit f7956c7

Browse files
committed
Add code samples to comments
1 parent 2851bf4 commit f7956c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6574
-3467
lines changed

firebase-firestore/api.txt

Lines changed: 806 additions & 771 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/PipelineTest.java

Lines changed: 575 additions & 199 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryToPipelineTest.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testLimitQueries() {
6767

6868
Query query = collection.limit(2);
6969
FirebaseFirestore db = collection.firestore;
70-
PipelineSnapshot set = waitFor(db.pipeline().createFrom(query).execute());
70+
Pipeline.Snapshot set = waitFor(db.pipeline().createFrom(query).execute());
7171
List<Map<String, Object>> data = pipelineSnapshotToValues(set);
7272
assertEquals(asList(map("k", "a"), map("k", "b")), data);
7373
}
@@ -84,7 +84,7 @@ public void testLimitQueriesUsingDescendingSortOrder() {
8484

8585
Query query = collection.limit(2).orderBy("sort", Direction.DESCENDING);
8686
FirebaseFirestore db = collection.firestore;
87-
PipelineSnapshot set = waitFor(db.pipeline().createFrom(query).execute());
87+
Pipeline.Snapshot set = waitFor(db.pipeline().createFrom(query).execute());
8888

8989
List<Map<String, Object>> data = pipelineSnapshotToValues(set);
9090
assertEquals(asList(map("k", "d", "sort", 2L), map("k", "c", "sort", 1L)), data);
@@ -114,7 +114,7 @@ public void testLimitToLastQueriesWithCursors() {
114114
Query query = collection.limitToLast(3).orderBy("sort").endBefore(2);
115115
FirebaseFirestore db = collection.firestore;
116116

117-
PipelineSnapshot set = waitFor(db.pipeline().createFrom(query).execute());
117+
Pipeline.Snapshot set = waitFor(db.pipeline().createFrom(query).execute());
118118
List<Map<String, Object>> data = pipelineSnapshotToValues(set);
119119
assertEquals(
120120
asList(map("k", "a", "sort", 0L), map("k", "b", "sort", 1L), map("k", "c", "sort", 1L)),
@@ -162,7 +162,7 @@ public void testKeyOrderIsDescendingForDescendingInequality() {
162162

163163
Query query = collection.whereGreaterThan("foo", 21.0).orderBy("foo", Direction.DESCENDING);
164164
FirebaseFirestore db = collection.firestore;
165-
PipelineSnapshot result = waitFor(db.pipeline().createFrom(query).execute());
165+
Pipeline.Snapshot result = waitFor(db.pipeline().createFrom(query).execute());
166166
assertEquals(asList("g", "f", "c", "b", "a"), pipelineSnapshotToIds(result));
167167
}
168168

@@ -175,7 +175,7 @@ public void testUnaryFilterQueries() {
175175
"b", map("null", null, "nan", 0),
176176
"c", map("null", false, "nan", Double.NaN)));
177177
FirebaseFirestore db = collection.firestore;
178-
PipelineSnapshot results =
178+
Pipeline.Snapshot results =
179179
waitFor(
180180
db.pipeline()
181181
.createFrom(collection.whereEqualTo("null", null).whereEqualTo("nan", Double.NaN))
@@ -195,7 +195,7 @@ public void testFilterOnInfinity() {
195195
"a", map("inf", Double.POSITIVE_INFINITY),
196196
"b", map("inf", Double.NEGATIVE_INFINITY)));
197197
FirebaseFirestore db = collection.firestore;
198-
PipelineSnapshot results =
198+
Pipeline.Snapshot results =
199199
waitFor(
200200
db.pipeline()
201201
.createFrom(collection.whereEqualTo("inf", Double.POSITIVE_INFINITY))
@@ -215,7 +215,7 @@ public void testCanExplicitlySortByDocumentId() {
215215
FirebaseFirestore db = collection.firestore;
216216
// Ideally this would be descending to validate it's different than
217217
// the default, but that requires an extra index
218-
PipelineSnapshot docs =
218+
Pipeline.Snapshot docs =
219219
waitFor(db.pipeline().createFrom(collection.orderBy(FieldPath.documentId())).execute());
220220
assertEquals(
221221
asList(testDocs.get("a"), testDocs.get("b"), testDocs.get("c")),
@@ -232,7 +232,7 @@ public void testCanQueryByDocumentId() {
232232
"bb", map("key", "bb"));
233233
CollectionReference collection = testCollectionWithDocs(testDocs);
234234
FirebaseFirestore db = collection.firestore;
235-
PipelineSnapshot docs =
235+
Pipeline.Snapshot docs =
236236
waitFor(
237237
db.pipeline()
238238
.createFrom(collection.whereEqualTo(FieldPath.documentId(), "ab"))
@@ -260,7 +260,7 @@ public void testCanQueryByDocumentIdUsingRefs() {
260260
"bb", map("key", "bb"));
261261
CollectionReference collection = testCollectionWithDocs(testDocs);
262262
FirebaseFirestore db = collection.firestore;
263-
PipelineSnapshot docs =
263+
Pipeline.Snapshot docs =
264264
waitFor(
265265
db.pipeline()
266266
.createFrom(
@@ -284,11 +284,11 @@ public void testCanQueryWithAndWithoutDocumentKey() {
284284
CollectionReference collection = testCollection();
285285
FirebaseFirestore db = collection.firestore;
286286
collection.add(map());
287-
Task<PipelineSnapshot> query1 =
287+
Task<Pipeline.Snapshot> query1 =
288288
db.pipeline()
289289
.createFrom(collection.orderBy(FieldPath.documentId(), Direction.ASCENDING))
290290
.execute();
291-
Task<PipelineSnapshot> query2 = db.pipeline().createFrom(collection).execute();
291+
Task<Pipeline.Snapshot> query2 = db.pipeline().createFrom(collection).execute();
292292

293293
waitFor(query1);
294294
waitFor(query2);
@@ -325,7 +325,7 @@ public void testQueriesCanUseNotEqualFilters() {
325325
expectedDocsMap.remove("i");
326326
expectedDocsMap.remove("j");
327327

328-
PipelineSnapshot snapshot =
328+
Pipeline.Snapshot snapshot =
329329
waitFor(db.pipeline().createFrom(collection.whereNotEqualTo("zip", 98101L)).execute());
330330
assertEquals(Lists.newArrayList(expectedDocsMap.values()), pipelineSnapshotToValues(snapshot));
331331

@@ -372,7 +372,7 @@ public void testQueriesCanUseNotEqualFiltersWithDocIds() {
372372
"bb", docD);
373373
CollectionReference collection = testCollectionWithDocs(testDocs);
374374
FirebaseFirestore db = collection.firestore;
375-
PipelineSnapshot docs =
375+
Pipeline.Snapshot docs =
376376
waitFor(
377377
db.pipeline()
378378
.createFrom(collection.whereNotEqualTo(FieldPath.documentId(), "aa"))
@@ -394,7 +394,7 @@ public void testQueriesCanUseArrayContainsFilters() {
394394
FirebaseFirestore db = collection.firestore;
395395

396396
// Search for "array" to contain 42
397-
PipelineSnapshot snapshot =
397+
Pipeline.Snapshot snapshot =
398398
waitFor(db.pipeline().createFrom(collection.whereArrayContains("array", 42L)).execute());
399399
assertEquals(asList(docA, docB, docD), pipelineSnapshotToValues(snapshot));
400400

@@ -426,7 +426,7 @@ public void testQueriesCanUseInFilters() {
426426
FirebaseFirestore db = collection.firestore;
427427

428428
// Search for zips matching 98101, 98103, or [98101, 98102].
429-
PipelineSnapshot snapshot =
429+
Pipeline.Snapshot snapshot =
430430
waitFor(
431431
db.pipeline()
432432
.createFrom(
@@ -480,7 +480,7 @@ public void testQueriesCanUseInFiltersWithDocIds() {
480480
"bb", docD);
481481
CollectionReference collection = testCollectionWithDocs(testDocs);
482482
FirebaseFirestore db = collection.firestore;
483-
PipelineSnapshot docs =
483+
Pipeline.Snapshot docs =
484484
waitFor(
485485
db.pipeline()
486486
.createFrom(collection.whereIn(FieldPath.documentId(), asList("aa", "ab")))
@@ -518,7 +518,7 @@ public void testQueriesCanUseNotInFilters() {
518518
expectedDocsMap.remove("i");
519519
expectedDocsMap.remove("j");
520520

521-
PipelineSnapshot snapshot =
521+
Pipeline.Snapshot snapshot =
522522
waitFor(
523523
db.pipeline()
524524
.createFrom(
@@ -581,7 +581,7 @@ public void testQueriesCanUseNotInFiltersWithDocIds() {
581581
"bb", docD);
582582
CollectionReference collection = testCollectionWithDocs(testDocs);
583583
FirebaseFirestore db = collection.firestore;
584-
PipelineSnapshot docs =
584+
Pipeline.Snapshot docs =
585585
waitFor(
586586
db.pipeline()
587587
.createFrom(collection.whereNotIn(FieldPath.documentId(), asList("aa", "ab")))
@@ -611,7 +611,7 @@ public void testQueriesCanUseArrayContainsAnyFilters() {
611611
// Search for "array" to contain [42, 43].
612612
Pipeline pipeline =
613613
db.pipeline().createFrom(collection.whereArrayContainsAny("array", asList(42L, 43L)));
614-
PipelineSnapshot snapshot = waitFor(pipeline.execute());
614+
Pipeline.Snapshot snapshot = waitFor(pipeline.execute());
615615
assertEquals(asList(docA, docB, docD, docE), pipelineSnapshotToValues(snapshot));
616616

617617
// With objects.
@@ -673,7 +673,7 @@ public void testCollectionGroupQueries() {
673673
}
674674
waitFor(batch.commit());
675675

676-
PipelineSnapshot snapshot =
676+
Pipeline.Snapshot snapshot =
677677
waitFor(db.pipeline().createFrom(db.collectionGroup(collectionGroup)).execute());
678678
assertEquals(
679679
asList("cg-doc1", "cg-doc2", "cg-doc3", "cg-doc4", "cg-doc5"),
@@ -703,7 +703,7 @@ public void testCollectionGroupQueriesWithStartAtEndAtWithArbitraryDocumentIds()
703703
}
704704
waitFor(batch.commit());
705705

706-
PipelineSnapshot snapshot =
706+
Pipeline.Snapshot snapshot =
707707
waitFor(
708708
db.pipeline()
709709
.createFrom(
@@ -749,7 +749,7 @@ public void testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIds() {
749749
}
750750
waitFor(batch.commit());
751751

752-
PipelineSnapshot snapshot =
752+
Pipeline.Snapshot snapshot =
753753
waitFor(
754754
db.pipeline()
755755
.createFrom(

0 commit comments

Comments
 (0)