Skip to content

bheads/d-leveldb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#D-Leveldb Build Status A Leveldb implementation for D. Requires leveldb deimos bindings.

##Example

import leveldb, std.stdio;

void main()
{
    auto opt = new Options;
    opt.create_if_missing = true;

    auto db = new DB(opt, "path_to_my_db_folder");
    db.put("Hello", "World");

    assert(db.get_slice("Hello").as!string == "World");

    db.put("PI", 3.14);

    foreach(Slice key, Slice value; db)
    {
        if(key.as!string == "PI")
            writeln(key.as!string, ": ", value.as!double);
        else
            writeln(key.as!string, ": ", value.as!string);
    }
}

##Leveldb Version: 1.16.0

Installation

Get this with dub.

To use this package, put the following dependency into your project's package.json into the dependencies section:

{
        ...
        "dependencies": {
                "d-leveldb": "~master"
        }
}