6.1.1 • Published 7 years ago

oolon-rethink v6.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

#oolon-rethink

makes it simple to run queries on rethink.db

##why? Rethinkdb is great! Their query language is awesome, but their nodejs driver is a little awkward to use.

rethink driver example:

const usersPromise = r.connect({host, port, path})
  .then((connection) => {
    return r
      .table('users')
      .run(connection)
      .then((cursor) => cursor.toArray())
  })

oolon-rethink wrap the rethinkdb cursor commands, so running queries is much easier:

const db = oolonRethink(rethinkUrl)
const usersPromise = db.toArray(r.table('users'))

This approach has several benefits.

  1. your db code is much simpler to write and read.
  2. oolon-rethink handles the database connection so you don't have to
  3. oolon-rethink handles all the side effects and async code, so you can focus on writing and testing pure functions

Usage

import r from 'rethinkdb'
import rethink from 'oolon-rethink'

const db = rethink('localhost:28015')

db.toArray(r.table('users'))
db.each(func, r.table('users'))
db.eachAsync(func, r.table('users'))
db.run(r.table('users').insert({name: 'brian'}))
6.1.1

7 years ago

6.1.0

8 years ago

6.0.1

8 years ago

6.0.0

8 years ago

5.0.0

8 years ago

4.0.0

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago