🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

rethink-struct

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rethink-struct

Assert that databases, tables, indexes exists on your Rethink server and create it if they don't

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
11
-15.38%
Maintainers
1
Weekly downloads
 
Created
Source

RethinkStruct

license npm

Overview

Assert that databases, tables, indexes exists on your Rethink server and create it if they don't.

Requirements

  • NodeJS 7.x.x or higher
  • Harmony flag --harmony_async_await

How to assert ?

Assertion is made by reading a JSON file. The JSON must be structurated like this:

{
  "databases": [
    {
      "name": "database_name",
      "tables": [
        {
          "name": "table_name",
          "indexes": ["field_to_index", "second_field_to_index"]
        },
        {
          "name": "another_table_name"
        }
      ]
    },
    {
      "name": "another_database_name",
      "tables": [
        "a_table"
      ]
    }
  ]
}

Then:

const rethink = require('rethinkdb')
const rethinkStruct = require('rethink-struct')
const rethinkConn = await rethink.connect()

await rethinkStruct(require('your.json'), rethinkConn)

Example

You can find an example in the example folder.

Keywords

rethink

FAQs

Package last updated on 21 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts