Skip to content
This repository was archived by the owner on Mar 16, 2020. It is now read-only.

Latest commit

 

History

History
38 lines (26 loc) · 773 Bytes

File metadata and controls

38 lines (26 loc) · 773 Bytes

LevelDB

Swift wrapper for LevelDB

Build Status

Usage

let fileURL = URL(fileURLWithPath: "/path/to/database")
let database = LevelDB(fileURL: fileURL)

// put `key` to `value`
database["key"] = value

// get value for `key` 
print(database["key"])

// delete `key`
database["key"] = nil

// enumerate through keys
database.enumerateKeys { key, value in
    // ...
}

// enumerate through keys with a specific prefix
let keyPrefix = "prefix_"
database.enumerateKeys(with: keyPrefix) { key, value in
    // ...
}

TODO

  • Wrap batch write
  • Provide APIs to customize db/read/write/iterator options