Skip to content

Instantly share code, notes, and snippets.

@pospi
Created August 4, 2016 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pospi/30718c23adf7cfce8f53902e9e2ca3de to your computer and use it in GitHub Desktop.
Save pospi/30718c23adf7cfce8f53902e9e2ca3de to your computer and use it in GitHub Desktop.
Curryable function to load `r.table` objects for horizon.io collections
const r = require('rethinkdb');
const { curry } = require('ramda');
module.exports = curry(function* (rdbConn, projectName, collectionName) {
const table = yield r.db(`${projectName}_internal`).table('collections').get(collectionName).getField('table').run(rdbConn);
return r.db(projectName).table(table);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment