Beispiel #1
0
    def delete(self, option=None):
        """Delete the current document in the Firestore database.

        Args:
            option (Optional[~.firestore_v1beta1.client.WriteOption]): A
               write option to make assertions / preconditions on the server
               state of the document before applying changes. Note that
               ``create_if_missing`` can't be used here since it does not
               apply (i.e. a "delete" cannot "create").

        Returns:
            google.protobuf.timestamp_pb2.Timestamp: The time that the delete
            request was received by the server. If the document did not exist
            when the delete was sent (i.e. nothing was deleted), this method
            will still succeed and will still return the time that the
            request was received by the server.

        Raises:
            ValueError: If the ``create_if_missing`` write option is used.
        """
        write_pb = _helpers.pb_for_delete(self._document_path, option)
        commit_response = self._client._firestore_api.commit(
            self._client._database_string, [write_pb],
            transaction=None,
            metadata=self._client._rpc_metadata)

        return commit_response.commit_time
    def delete(self, reference, option=None):
        """Add a "change" to delete a document.

        See
        :meth:`~.firestore_v1beta1.document.DocumentReference.delete` for
        more information on how ``option`` determines how the change is
        applied.

        Args:
            reference (~.firestore_v1beta1.document.DocumentReference): A
               document reference that will be deleted in this batch.
            option (Optional[~.firestore_v1beta1.client.WriteOption]): A
               write option to make assertions / preconditions on the server
               state of the document before applying changes.
        """
        write_pb = _helpers.pb_for_delete(reference._document_path, option)
        self._add_write_pbs([write_pb])
Beispiel #3
0
    def delete(self, reference, option=None):
        """Add a "change" to delete a document.

        See
        :meth:`~google.cloud.firestore_v1beta1.document.DocumentReference.delete`
        for more information on how ``option`` determines how the change is
        applied.

        Args:
            reference (~.firestore_v1beta1.document.DocumentReference): A
               document reference that will be deleted in this batch.
            option (Optional[~.firestore_v1beta1.client.WriteOption]): A
               write option to make assertions / preconditions on the server
               state of the document before applying changes.
        """
        write_pb = _helpers.pb_for_delete(reference._document_path, option)
        self._add_write_pbs([write_pb])
Beispiel #4
0
    def delete(self, option=None):
        """Delete the current document in the Firestore database.

        Args:
            option (Optional[~.firestore_v1beta1.client.WriteOption]): A
               write option to make assertions / preconditions on the server
               state of the document before applying changes.

        Returns:
            google.protobuf.timestamp_pb2.Timestamp: The time that the delete
            request was received by the server. If the document did not exist
            when the delete was sent (i.e. nothing was deleted), this method
            will still succeed and will still return the time that the
            request was received by the server.
        """
        write_pb = _helpers.pb_for_delete(self._document_path, option)
        commit_response = self._client._firestore_api.commit(
            self._client._database_string, [write_pb], transaction=None,
            metadata=self._client._rpc_metadata)

        return commit_response.commit_time
    def _call_fut(document_path, option):
        from google.cloud.firestore_v1beta1._helpers import pb_for_delete

        return pb_for_delete(document_path, option)