pub enum Command {
Insert {
id: Option<DocumentId>,
contents: Bytes,
},
Update {
header: Header,
contents: Bytes,
},
Overwrite {
id: DocumentId,
contents: Bytes,
},
Delete {
header: Header,
},
Check {
id: DocumentId,
revision: Option<Revision>,
},
}Expand description
A command to execute within a Collection.
Variants§
Insert
Inserts a new document containing contents.
Fields
id: Option<DocumentId>An optional id for the document. If this is None, a unique id will
be generated. If this is Some() and a document already exists with
that id, a conflict error will be returned.
Update
Update an existing Document identified by header. header.revision must match
the currently stored revision on the Document. If it does not, the
command fill fail with a DocumentConflict error.
Fields
Overwrite
Overwrite an existing Document identified by id. The revision will
not be checked before the document is updated. If the document does not
exist, it will be created.
Fields
id: DocumentIdThe id of the document to overwrite.
Delete
Delete an existing Document identified by id. revision must match
the currently stored revision on the Document. If it does not, the
command fill fail with a DocumentConflict error.
Check
Checks whether a document exists, and optionally whether its revision is
still current. If the document is not found, a DocumentNotFound error
will be returned. If the document revision is provided and does not
match, a DocumentConflict error will be returned.
Fields
id: DocumentIdThe id of the document to check.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Command
impl<'de> Deserialize<'de> for Command
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more