Struct bonsaidb::core::transaction::Transaction
source · [−]Expand description
A list of operations to execute as a single unit. If any operation fails, all changes are aborted. Reads that happen while the transaction is in progress will return old data and not block.
Fields
operations: Vec<Operation, Global>
The operations in this transaction.
Implementations
Returns a new, empty transaction.
Appends an operation to the transaction and returns self.
pub fn insert(
collection: CollectionName,
id: Option<u64>,
contents: impl Into<Bytes>
) -> Transaction
pub fn insert(
collection: CollectionName,
id: Option<u64>,
contents: impl Into<Bytes>
) -> Transaction
Inserts a new document with contents
into collection
. If id
is
None
a unique id will be generated. If an id is provided and a
document already exists with that id, a conflict error will be returned.
pub fn update(
collection: CollectionName,
header: Header,
contents: impl Into<Bytes>
) -> Transaction
pub fn update(
collection: CollectionName,
header: Header,
contents: impl Into<Bytes>
) -> Transaction
Updates a document in collection
.
Deletes a document from a collection
.
Trait Implementations
Returns the “default value” for a type. Read more
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Transaction, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Transaction, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more