pub struct DBTransaction {
pub ops: Vec<DBOp>,
}
Expand description
Write transaction. Batches a sequence of put/delete operations for efficiency.
Fields§
§ops: Vec<DBOp>
Database operations.
Implementations§
Source§impl DBTransaction
impl DBTransaction
Sourcepub fn new() -> DBTransaction
pub fn new() -> DBTransaction
Create new transaction.
Sourcepub fn with_capacity(cap: usize) -> DBTransaction
pub fn with_capacity(cap: usize) -> DBTransaction
Create new transaction with capacity.
Sourcepub fn put(&mut self, col: u32, key: &[u8], value: &[u8])
pub fn put(&mut self, col: u32, key: &[u8], value: &[u8])
Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
Sourcepub fn put_vec(&mut self, col: u32, key: &[u8], value: Vec<u8>)
pub fn put_vec(&mut self, col: u32, key: &[u8], value: Vec<u8>)
Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
Sourcepub fn delete_prefix(&mut self, col: u32, prefix: &[u8])
pub fn delete_prefix(&mut self, col: u32, prefix: &[u8])
Delete all values with the given key prefix. Using an empty prefix here will remove all keys (all keys start with the empty prefix).
Trait Implementations§
Source§impl Clone for DBTransaction
impl Clone for DBTransaction
Source§fn clone(&self) -> DBTransaction
fn clone(&self) -> DBTransaction
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for DBTransaction
impl Default for DBTransaction
Source§fn default() -> DBTransaction
fn default() -> DBTransaction
Returns the “default value” for a type. Read more
Source§impl PartialEq for DBTransaction
impl PartialEq for DBTransaction
impl StructuralPartialEq for DBTransaction
Auto Trait Implementations§
impl Freeze for DBTransaction
impl RefUnwindSafe for DBTransaction
impl Send for DBTransaction
impl Sync for DBTransaction
impl Unpin for DBTransaction
impl UnwindSafe for DBTransaction
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<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
impl<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
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>
Converts
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>
Converts
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