Enum bonsaidb_core::transaction::Command
source · [−]pub enum Command {
Insert {
id: Option<DocumentId>,
contents: Bytes,
},
Update {
header: Header,
contents: Bytes,
},
Overwrite {
id: DocumentId,
contents: Bytes,
},
Delete {
header: Header,
},
}Expand description
A command to execute within a Collection.
Variants
Insert
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.
contents: BytesThe initial contents of the document.
Inserts a new document containing contents.
Update
Fields
header: HeaderThe header of the Document. The revision must match the current
document.
contents: BytesThe new contents to store within the Document.
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.
Overwrite
Fields
id: DocumentIdThe id of the document to overwrite.
contents: BytesThe new contents to store within the Document.
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.
Delete
Fields
header: HeaderThe current header of the Document.
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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Command
impl<'de> Deserialize<'de> for Command
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more