dddb 0.0.4
Dddb lightweight and simple key-value store
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
dddb
dddb is lightweight and simple key-value dlang database (store) build on top of std.json
Usage
import std.stdio;
import dddb;
void main() {
auto db = new ddb("test.db");
// set facebook value to fb
db.set("facebook", "fb");
// set instagram value to insta
db.set("instagram", "insta");
// get facebook value
writeln(db.get("facebook")); // fb
// get instagram value
writeln(db.get("instagram")); // insta
// assertions
assert(db.get("facebook") == "fb");
assert(db.get("instagram") == "insta");
// update facebook value to ffb
db.update("facebook", "ffb");
writeln(db.get("facebook")); // ffb
// db.getkeys() return a list of all keys
writeln(db.getkeys());
// db.countkeys() return the lenght of databae keys
assert(db.countkeys() == 2);
writeln(db.countkeys()); // 2
assert(db.getsize() == 38);
// db.getsize() return the database size in bytes
writeln(db.getsize()); // 38
// db.drop() delete database
// NOTE: all db data will be lost
db.drop();
assert(exists(db.db) == false);
}
- Registered by cvsae
- 0.0.4 released 6 years ago
- cvsae/dddb
- MIT
- Copyright © 2018, cvsae
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.6 2018-Jul-01 0.0.5 2018-Jul-01 0.0.4 2018-Mar-25 0.0.3 2018-Mar-25 0.0.2 2018-Mar-23 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
51 downloads total
-
- Score:
- 1.4
- Short URL:
- dddb.dub.pm