pub trait DbCursorRW<T>where
T: Table,{
// Required methods
fn upsert(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>;
fn insert(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>;
fn append(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>;
fn delete_current(&mut self) -> Result<(), DatabaseError>;
}
Expand description
Read write cursor over table.
Required Methods§
Sourcefn upsert(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>
fn upsert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>
Database operation that will update an existing row if a specified value already exists in a table, and insert a new row if the specified value doesn’t already exist
Sourcefn insert(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>
fn insert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>
Database operation that will insert a row at a given key. If the key is already present, the operation will result in an error.
Sourcefn append(
&mut self,
key: <T as Table>::Key,
value: <T as Table>::Value,
) -> Result<(), DatabaseError>
fn append( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>
Append value to next cursor item.
This is efficient for pre-sorted data. If the data is not pre-sorted, use
DbCursorRW::insert
.
Sourcefn delete_current(&mut self) -> Result<(), DatabaseError>
fn delete_current(&mut self) -> Result<(), DatabaseError>
Delete current value that cursor points to
Implementors§
impl<T> DbCursorRW<T> for CursorMockwhere
T: Table,
impl<T: Table> DbCursorRW<T> for Cursor<RW, T>
Available on crate feature
mdbx
only.