Class DatabaseQuery.Util

java.lang.Object
com.syzygy.events.database.DatabaseQuery.Util
Enclosing class:
DatabaseQuery<T extends DatabaseInstance<T>>

public static class DatabaseQuery.Util extends Object
Tools to query for documents without loading them
  • 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 evaluate
      listener - 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 update
      field - The field to change
      value - The new value that the field should be
      onComplete - The listener, returns how many errors occured
    • deleteDocuments

      public static void deleteDocuments(List<com.google.firebase.firestore.DocumentSnapshot> documents)
      Deletes the documents from the database. WARNING!!! DOES NOT DELETE SUB INSTANCES
      Parameters:
      documents - The documents to delete