From e987ff6c0a476ba2319c9651fcc8c15282ac8ab4 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Sat, 28 Sep 2024 01:43:24 +0700 Subject: [PATCH] Update grovedb/src/operations/insert/mod.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- grovedb/src/operations/insert/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/grovedb/src/operations/insert/mod.rs b/grovedb/src/operations/insert/mod.rs index ca64dcf4..caaaa1f1 100644 --- a/grovedb/src/operations/insert/mod.rs +++ b/grovedb/src/operations/insert/mod.rs @@ -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, 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,