cberner / redb

An embedded key-value database in pure Rust
https://www.redb.org
Apache License 2.0
3.07k stars 137 forks source link

Please clarify if `Table.insert()` does replace the attribute if it exists #787

Closed abique closed 3 months ago

abique commented 3 months ago

Hi,

From reading the doc, it is unclear if Table.instert() does replace or not existing entries.

Thanks, Alex

cberner commented 3 months ago

It does. All the APIs are designed to be similar in function to std::collections::BtreeMap

On Sun, Mar 31, 2024 at 12:16 PM Alexandre Bique @.***> wrote:

Hi,

From reading the doc, it is unclear if Table.instert() https://docs.rs/redb/latest/redb/struct.Table.html#method.insert does replace or not existing entries.

Thanks, Alex

— Reply to this email directly, view it on GitHub https://github.com/cberner/redb/issues/787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGNXQFX6ZXGNGFIXBLW5TLY3BOI5AVCNFSM6AAAAABFQURVTOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTOMJUHA2TEMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

abique commented 3 months ago

OK, thanks for the clarification :+1: . https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.insert seems to explicitly describe the update scenario.