pub enum FirestoreWritePrecondition {
Exists(bool),
UpdateTime(DateTime<Utc>),
}
Expand description
A precondition on a document, used for conditional write operations in Firestore.
Preconditions allow you to specify conditions that must be met for a write
operation (create, update, delete) to succeed. If the precondition is not met,
the operation will fail, typically with a DataConflictError
or similar.
Variants§
Exists(bool)
The target document must exist (if true
) or must not exist (if false
).
Exists(true)
: The operation will only succeed if the document already exists. Useful for conditional updates or deletes.Exists(false)
: The operation will only succeed if the document does not already exist. Useful for conditional creates (to prevent overwriting).
UpdateTime(DateTime<Utc>)
The target document must exist and its update_time
must match the provided timestamp.
This is used for optimistic concurrency control. The operation will only succeed
if the document has not been modified since the specified update_time
.
The DateTime<Utc>
must be microsecond-aligned, as Firestore timestamps have
microsecond precision.
Trait Implementations§
Source§impl Clone for FirestoreWritePrecondition
impl Clone for FirestoreWritePrecondition
Source§fn clone(&self) -> FirestoreWritePrecondition
fn clone(&self) -> FirestoreWritePrecondition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FirestoreWritePrecondition
impl Debug for FirestoreWritePrecondition
Source§impl TryInto<Precondition> for FirestoreWritePrecondition
impl TryInto<Precondition> for FirestoreWritePrecondition
Source§type Error = FirestoreError
type Error = FirestoreError
The type returned in the event of a conversion error.
impl Eq for FirestoreWritePrecondition
impl StructuralPartialEq for FirestoreWritePrecondition
Auto Trait Implementations§
impl Freeze for FirestoreWritePrecondition
impl RefUnwindSafe for FirestoreWritePrecondition
impl Send for FirestoreWritePrecondition
impl Sync for FirestoreWritePrecondition
impl Unpin for FirestoreWritePrecondition
impl UnwindSafe for FirestoreWritePrecondition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request