Skip to content

Commit

Permalink
Update grovedb/src/operations/insert/mod.rs
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
QuantumExplorer and coderabbitai[bot] authored Sep 27, 2024
1 parent 1020875 commit e987ff6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions grovedb/src/operations/insert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,21 @@ impl GroveDb {

/// Insert if not exists
/// If the item does exist return it
///
/// Inserts an element at the given `path` and `key` if it does not exist.
/// If the element already exists, returns the existing element.
///
/// # Arguments
///
/// * `path` - The path where the element should be inserted.
/// * `key` - The key under which the element should be inserted.
/// * `element` - The element to insert.
/// * `transaction` - The transaction argument, if any.
/// * `grove_version` - The GroveDB version.
///
/// # Returns
///
/// Returns a `CostResult<Option<Element>, Error>`, where `Ok(Some(element))` is the existing element if it was found, or `Ok(None)` if the new element was inserted.
pub fn insert_if_not_exists_return_existing_element<'b, B, P>(
&self,
path: P,
Expand Down

0 comments on commit e987ff6

Please sign in to comment.