Skip to content

Commit 21d6208

Browse files
authored
feat(firestore): add missing aggregates (#99)
* feat(firestore): add missing aggregates * fix CI * format * update README * fieldpath allowed
1 parent 1547699 commit 21d6208

File tree

6 files changed

+750
-81
lines changed

6 files changed

+750
-81
lines changed

packages/dart_firebase_admin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ print(user.data()?['age']);
203203
| query.limitToLast ||
204204
| query.offset ||
205205
| query.count() ||
206-
| query.sum() | |
207-
| query.average() | |
206+
| query.sum() | |
207+
| query.average() | |
208208
| querySnapshot.docs ||
209209
| querySnapshot.readTime ||
210210
| documentSnapshots.data ||

packages/dart_firebase_admin/lib/src/google_cloud_firestore/document.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class DocumentSnapshot<T> {
179179
/// }
180180
/// });
181181
/// ```
182-
bool get exists => this._fieldsProto != null;
182+
bool get exists => _fieldsProto != null;
183183

184184
/// Retrieves all fields in the document as an object. Returns 'undefined' if
185185
/// the document doesn't exist.
@@ -196,7 +196,7 @@ class DocumentSnapshot<T> {
196196
/// });
197197
/// ```
198198
T? data() {
199-
final fieldsProto = this._fieldsProto;
199+
final fieldsProto = _fieldsProto;
200200
final fields = fieldsProto?.fields;
201201
if (fields == null || fieldsProto == null) return null;
202202

@@ -245,7 +245,7 @@ class DocumentSnapshot<T> {
245245
}
246246

247247
firestore1.Value? _protoField(FieldPath field) {
248-
final fieldsProto = this._fieldsProto?.fields;
248+
final fieldsProto = _fieldsProto?.fields;
249249
if (fieldsProto == null) return null;
250250
var fields = fieldsProto;
251251

@@ -300,11 +300,11 @@ class _DocumentSnapshotBuilder<T> {
300300

301301
DocumentSnapshot<T> build() {
302302
assert(
303-
(this.fieldsProto != null) == (this.createTime != null),
303+
(this.fieldsProto != null) == (createTime != null),
304304
'Create time should be set iff document exists.',
305305
);
306306
assert(
307-
(this.fieldsProto != null) == (this.updateTime != null),
307+
(this.fieldsProto != null) == (updateTime != null),
308308
'Update time should be set iff document exists.',
309309
);
310310

packages/dart_firebase_admin/lib/src/google_cloud_firestore/document_reader.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class _DocumentReader<T> {
9090
DocumentSnapshot<DocumentData>? documentSnapshot;
9191

9292
if (response.transaction?.isNotEmpty ?? false) {
93-
this._retrievedTransactionId = response.transaction;
93+
_retrievedTransactionId = response.transaction;
9494
}
9595

9696
final found = response.found;

packages/dart_firebase_admin/lib/src/google_cloud_firestore/path.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ abstract class _Path<T extends _Path<Object?>> implements Comparable<_Path<T>> {
5353

5454
/// Checks whether the current path is a prefix of the specified path.
5555
bool _isPrefixOf(_Path<T> other) {
56-
if (other.segments.length < this.segments.length) {
56+
if (other.segments.length < segments.length) {
5757
return false;
5858
}
5959

60-
for (var i = 0; i < this.segments.length; i++) {
61-
if (this.segments[i] != other.segments[i]) {
60+
for (var i = 0; i < segments.length; i++) {
61+
if (segments[i] != other.segments[i]) {
6262
return false;
6363
}
6464
}
@@ -74,8 +74,8 @@ abstract class _Path<T extends _Path<Object?>> implements Comparable<_Path<T>> {
7474
if (compare != 0) return compare;
7575
}
7676

77-
if (this.segments.length < other.segments.length) return -1;
78-
if (this.segments.length > other.segments.length) return 1;
77+
if (segments.length < other.segments.length) return -1;
78+
if (segments.length > other.segments.length) return 1;
7979

8080
return 0;
8181
}

0 commit comments

Comments
 (0)