A carefuly created set of bindings to present an easy way to handle 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.
- $ yarn add rethinkly
- $ npm i rethinkly --save
- createLink
- data get insert remove update seed
- table
- create
- drop database
- create
- drop
- checkForExistence
- list
import { createLink } from 'rethinkly'
const dbConfig = {
host: process.env.ENV === 'mock' ? '172.18.0.2' : 'localhost',
port: 32769,
db: 'the_database',
}
const instance = createLink(dbConfig)
- Method to get a list or a specific value from a table.
- connection: object
- tableName: string
- id?: string
import { createLink, data } from 'rethinkly'
const instance = createLink(dbConfig)
// Get your data as list
const users = data.get(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 = data.get(instance, 'users', { role: '99bd6af9-922e-4787-a97d-3d915f60e65b' })
/**
* Implicit byId
*/
const users = data.get(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'
}
]
*/