Code Monkey home page Code Monkey logo

ueberdb's Introduction

About

Abstract your databases, make datababies. ueberDB turns every database into a simple key value store by providing a layer of abstraction between your software and your database. ueberDB uses a smart cache and buffer algorithm to make databases faster. Reads are cached and writes are done in a bulk. The bulk writing reduces the overhead of a database transaction. The syntax is simple and clean and getting started is easy.

Database Support

  • Couch
  • Crate
  • Dirty
  • Elasticsearch
  • Level
  • Mongo
  • MySQL
  • Postgres
  • Redis
  • RethinkDB
  • SQLite

Install

npm install ueberDB

Example

var ueberDB = require("ueberDB");

//mysql
var db = new ueberDB.database("mysql", {"user":"root", host: "localhost", "password":"", database: "store"});
//sqlite in-memory
//var db = new ueberDB.database("sqlite");
//sqlite in file
//var db = new ueberDB.database("sqlite", {filename:"var/sqlite3.db"});
//sqlite in file with a write interval of a half second
//var db = new ueberDB.database("sqlite", {filename:"var/sqlite3.db"}, {writeInterval: 500});

//initialize the database
db.init(function (err)
{
  if(err)
  {
    console.error(err);
    process.exit(1);
  }

  //set a object as a value
  //can be done without a callback, cause the value is immediately in the buffer
  db.set("valueA", {a:1,b:2});

  //get the object
  db.get("valueA", function(err, value){
    console.log(value);

    db.close(function(){
      process.exit(0);
    });
  });
});

How to add support for another database

Look at sqlite_db.js and mysql_db.js, your module have to provide the same functions. Call it DATABASENAME_db.js and reimplement the functions for your database. If you think it works, test it with node benchmark.js DATABASENAME. Benchmark.js is benchmark and test at the same time. It tries to set 100000 values. You can pipe stderr to a file and will create a csv with benchmark results.

Limitations

Only mysql, dirty, mongodb, couch, rethink and crate currently support findKeys feature. The following do not yet support the function:

  • leveldb
  • redis (Only keys of the format *:*:*)
  • cassandra (Only keys of the format *:*:*)
  • elasticsearch (Only keys of the format *:*:*)

For details on how it works please refer to the wiki: https://github.com/Pita/ueberDB/wiki/findKeys-functionality

License

Apache License v2

ueberdb's People

Contributors

johnmclear avatar pita avatar azul avatar ulikoehler avatar hiswe avatar ldidry avatar gared avatar simong avatar mosely avatar markgeraty avatar jkutner avatar cebe avatar luto avatar booo avatar younggi avatar t-8ch avatar marcelklehr avatar lpagliari avatar 19h avatar ra1d3n avatar chrisballinger avatar mrvisser avatar bjnortier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.