#key-value-store #hash-map #local #send-sync #persistent #dictionary

db-map

A local, Send & Sync, key-value store that acts like a HashMap

2 releases

0.1.1 Nov 20, 2024
0.1.0 Feb 28, 2024

#2234 in Database interfaces

Download history 14/week @ 2024-09-23 1/week @ 2024-10-14 9/week @ 2024-11-04 154/week @ 2024-11-18 14/week @ 2024-11-25 26/week @ 2024-12-09

194 downloads per month

Unlicense

5KB
89 lines

db-map

A Send&Sync typed key-value store - persisted to the disk with SQLite - with the following methods:

  • insert(key, value)
  • get(key) -> value
  • get_keys(value) -> [keys]
use db_map::DBMap;
use anyhow::Result;

fn db_map_demo() -> Result<()> {
    let db_map: DBMap<String, u64> = DBMap::new("db_map.db")?;
    db_map.insert("Test".to_string(), 42)?;
    db_map.insert("Hello".to_string(), 1)?;
    db_map.insert("World".to_string(), 1)?;
    assert_eq!(db_map.get("Test".to_string())?, 42);
    assert_eq!(db_map.get_keys(1)?, ["Hello".to_string(), "World".to_string()]);
    Ok(())
}

Dependencies

~22MB
~429K SLoC