Struct kvdb::DBTransaction
source · 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 copy 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 Default for DBTransaction
impl Default for DBTransaction
source§fn default() -> DBTransaction
fn default() -> DBTransaction
Returns the “default value” for a type. Read more