Skip to content
An easy way to retrieve data from rethinkdb instances
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github/ISSUE_TEMPLATE
__tests__
src
.editorconfig
.env.sample
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
_config.yml
index.js
package.json
yarn.lock

README.md

Rethinkly 🚀

CircleCI Maintainability Test Coverage

👷 Work in progress 🚧

A carefuly created set of bindings to present an easy way to retrieve data from RethinkDB instances.

Rethinkly is a collection of methods to make more literal and legible gathering data from rethink into JavaScript applications. Supports node and browser.

Rethink. Again.

Installation

- $ yarn add rethinkly
- $ npm i rethinkly --save

Available methods:

  • rethinkly
  • retrieveData

Usage

import rethinkly from 'rethinkly'

const dbConfig = {
	host: 'localhost',
	port: 32769,
	db: 'the_database'
};

const instance = rethinkly(dbConfig);

API

retrieveData
  • Method to get a list or a specific value from a table.

Params:

  • connection: object
  • tableName: string
  • id?: string

Example

import rethinkly, { retrieveData } from 'rethinkly'
const instance = rethinkly(dbConfig)

// Get your data as list
const users = retrieveData(instance, 'users')
/** output 
[
    {
        id: 'a3bbd8e3-b53f-4ecd-bab9-6c65cfcf931b',
        name: 'Caio Alcantara',
        nickname: 'caio',
        role: '99bd6af9-922e-4787-a97d-3d915f60e65b'
    }
]
*/


/**
* Match your results using where clause
*/
const users = retrieveData(instance, 'users', { role: '99bd6af9-922e-4787-a97d-3d915f60e65b' })
/**

* Implicit byId
*/
const users = retrieveData(instance, 'users', 'a3bbd8e3-b53f-4ecd-bab9-6c65cfcf931b')

/** output 
[
    {
        id: 'a3bbd8e3-b53f-4ecd-bab9-6c65cfcf931b',
        name: 'Caio Alcantara',
        nickname: 'caio',
        role: '99bd6af9-922e-4787-a97d-3d915f60e65b'
    }
]
*/
You can’t perform that action at this time.