Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Feature: isEqual on Query and CollectionReference #1775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/firebase.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,9 @@ firebase.firestore._getCollectionReference = (colRef?: JCollectionReference): fi
startAfter: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAfter(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
startAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAt(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
endAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endAt(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, colRef)
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
android: colRef,
isEqual: (other: firestore.Query): boolean => colRef.equals(other ? other.android : null)
};
};

Expand Down Expand Up @@ -2780,7 +2782,9 @@ firebase.firestore._getQuery = (collectionPath: string, query: com.google.fireba
startAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAt(collectionPath, snapshotOrFieldValue, fieldValues, query),
endAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endAt(collectionPath, snapshotOrFieldValue, fieldValues, query),
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, query),
firestore: firebase.firestore
firestore: firebase.firestore,
android: query,
isEqual: (other: firestore.Query): boolean => query.equals(other ? other.android : null)
};
};

Expand Down
6 changes: 6 additions & 0 deletions src/firebase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,12 @@ export namespace firestore {
endBefore(snapshot: DocumentSnapshot): Query;

endBefore(...fieldValues: any[]): Query;

ios?: FIRQuery;

android?: com.google.firebase.firestore.Query;

isEqual: (other: firestore.Query) => boolean;
}

export interface CollectionGroup {
Expand Down
8 changes: 6 additions & 2 deletions src/firebase.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2144,7 +2144,9 @@ firebase.firestore._getCollectionReference = (colRef?: FIRCollectionReference):
startAfter: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAfter(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
startAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAt(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
endAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endAt(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, colRef)
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, colRef),
ios: colRef,
isEqual: (other: firestore.Query): boolean => colRef.isEqual(other ? other.ios : null)
};
};

Expand Down Expand Up @@ -2437,7 +2439,9 @@ firebase.firestore._getQuery = (collectionPath: string, query: FIRQuery): firest
startAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.startAt(collectionPath, snapshotOrFieldValue, fieldValues, query),
endAt: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endAt(collectionPath, snapshotOrFieldValue, fieldValues, query),
endBefore: (snapshotOrFieldValue: DocumentSnapshot | any, ...fieldValues: any[]): firestore.Query => firebase.firestore.endBefore(collectionPath, snapshotOrFieldValue, fieldValues, query),
firestore: firebase.firestore
firestore: firebase.firestore,
ios: query,
isEqual: (other: firestore.Query): boolean => query.isEqual(other ? other.ios : null)
};
};

Expand Down
2 changes: 2 additions & 0 deletions src/platforms/ios/typings/objc!FirebaseFirestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ declare class FIRQuery extends NSObject {

addSnapshotListenerWithIncludeMetadataChangesListener(includeMetadataChanges: boolean, listener: (p1: FIRQuerySnapshot, p2: NSError) => void): FIRListenerRegistration;

isEqual(other: FIRQuery): boolean;

getDocumentsWithCompletion(completion: (p1: FIRQuerySnapshot, p2: NSError) => void): void;

getDocumentsWithSourceCompletion(source: FIRFirestoreSource, completion: (p1: FIRQuerySnapshot, p2: NSError) => void): void;
Expand Down