0.2.1 • Published 10 years ago

co-rdb v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Rethinkdb driver wrapper for Co and helpers for testing.

Installation

$ npm install rethinkdb
$ npm install co-rdb

Example

var rdb = require('co-rdb');
var r = require('rethinkdb');

co(function *() {
    var conf = {
        db: 'someDbName', // default test
        host: '1.1.1.1', // default localhost
        port: '8888', // default 28015
        tables: {
            firstTableName: 'primaryKey',
            secondTableName: '',  // default id
            tableNameWithSecondaryIndex: ['primaryKey', 'secondaryIndex']
        }
    };

    var conn = yield rdb.conn(opt); // create connection
    yield rdb.setup(conf); // create db and tables

    yield rdb.run(r.table('test').insert({ data: 'awesome data' }), conn) // run db query
    yield rdb.run(r.table('test'), conn) // run db query and apply toArray for cursor

    yield rdb.clear(['firstTableName', 'secondTableName'], conn) // clear tables
    yield rdb.clear(conn) // clear all tables

})();

Running tests

$ make test

Authors

License

MIT

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago