pub struct Transaction<K, V>where
K: Ord + Clone + Debug + Sync + Send + 'static,
V: Eq + Clone + Debug + Sync + Send + 'static,{ /* private fields */ }Expand description
A serializable snapshot isolated database transaction
Implementations§
Source§impl<K, V> Transaction<K, V>
impl<K, V> Transaction<K, V>
Sourcepub fn exists<Q>(&self, key: Q) -> Result<bool, Error>where
Q: Borrow<K>,
pub fn exists<Q>(&self, key: Q) -> Result<bool, Error>where
Q: Borrow<K>,
Check if a key exists in the database
Sourcepub fn get<Q>(&self, key: Q) -> Result<Option<V>, Error>where
Q: Borrow<K>,
pub fn get<Q>(&self, key: Q) -> Result<Option<V>, Error>where
Q: Borrow<K>,
Fetch a key from the database
Sourcepub fn set<Q>(&mut self, key: Q, val: V) -> Result<(), Error>where
Q: Into<K>,
pub fn set<Q>(&mut self, key: Q, val: V) -> Result<(), Error>where
Q: Into<K>,
Insert or update a key in the database
Sourcepub fn put<Q>(&mut self, key: Q, val: V) -> Result<(), Error>
pub fn put<Q>(&mut self, key: Q, val: V) -> Result<(), Error>
Insert a key if it doesn’t exist in the database
Sourcepub fn putc<Q>(&mut self, key: Q, val: V, chk: Option<V>) -> Result<(), Error>
pub fn putc<Q>(&mut self, key: Q, val: V, chk: Option<V>) -> Result<(), Error>
Insert a key if it matches a value
Sourcepub fn del<Q>(&mut self, key: Q) -> Result<(), Error>where
Q: Borrow<K>,
pub fn del<Q>(&mut self, key: Q) -> Result<(), Error>where
Q: Borrow<K>,
Delete a key from the database
Sourcepub fn delc<Q>(&mut self, key: Q, chk: Option<V>) -> Result<(), Error>
pub fn delc<Q>(&mut self, key: Q, chk: Option<V>) -> Result<(), Error>
Delete a key if it matches a value
Auto Trait Implementations§
impl<K, V> Freeze for Transaction<K, V>
impl<K, V> !RefUnwindSafe for Transaction<K, V>
impl<K, V> Send for Transaction<K, V>
impl<K, V> Sync for Transaction<K, V>
impl<K, V> Unpin for Transaction<K, V>
impl<K, V> !UnwindSafe for Transaction<K, V>
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