Package com.syzygy.events.database
Class DatabaseQuery.Util
java.lang.Object
com.syzygy.events.database.DatabaseQuery.Util
- Enclosing class:
- DatabaseQuery<T extends DatabaseInstance<T>>
Tools to query for documents without loading them
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
deleteDocuments
(List<com.google.firebase.firestore.DocumentSnapshot> documents) Deletes the documents from the database.static void
getDocumentsFromQuery
(com.google.firebase.firestore.Query q, BiConsumer<List<com.google.firebase.firestore.DocumentSnapshot>, Boolean> listener) Gets the documents matching the query.static void
updateFieldOfDocuments
(List<com.google.firebase.firestore.DocumentSnapshot> documents, String field, Object value, Consumer<Integer> onComplete) Updates the field on each field WARNING!! DOES NOT TEST THE VALIDITY OF THE VALUE
-
Constructor Details
-
Util
private Util()
-
-
Method Details
-
getDocumentsFromQuery
public static void getDocumentsFromQuery(com.google.firebase.firestore.Query q, BiConsumer<List<com.google.firebase.firestore.DocumentSnapshot>, Boolean> listener) Gets the documents matching the query. Returns all results and does not load the instances- Parameters:
q
- The query to evaluatelistener
- The on complete listener
-
updateFieldOfDocuments
public static void updateFieldOfDocuments(List<com.google.firebase.firestore.DocumentSnapshot> documents, String field, Object value, Consumer<Integer> onComplete) Updates the field on each field WARNING!! DOES NOT TEST THE VALIDITY OF THE VALUE- Parameters:
documents
- The documents to updatefield
- The field to changevalue
- The new value that the field should beonComplete
- The listener, returns how many errors occured
-
deleteDocuments
Deletes the documents from the database. WARNING!!! DOES NOT DELETE SUB INSTANCES- Parameters:
documents
- The documents to delete
-