pub trait DbCursorRW<T: Table> {
// Required methods
fn upsert(
&mut self,
key: T::Key,
value: T::Value,
) -> Result<(), DatabaseError>;
fn insert(
&mut self,
key: T::Key,
value: T::Value,
) -> Result<(), DatabaseError>;
fn append(
&mut self,
key: T::Key,
value: T::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::Key, value: T::Value) -> Result<(), DatabaseError>
fn upsert(&mut self, key: T::Key, value: T::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::Key, value: T::Value) -> Result<(), DatabaseError>
fn insert(&mut self, key: T::Key, value: T::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::Key, value: T::Value) -> Result<(), DatabaseError>
fn append(&mut self, key: T::Key, value: T::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