db-map 0.1.1

A local, Send & Sync, key-value store that acts like a HashMap
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 11.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 699.66 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 55s Average build duration of successful builds.
  • all releases: 55s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Inspirateur/db-map
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Inspirateur

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(())
}