0.0.19 • Published 7 years ago

relationize v0.0.19

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

relationize

Takes a set of JSON Schema definitions and returns a relational database structure capable of storing compliant data.

Install

$ npm install relationize --save

Usage

  const relationize = require('relationize')

  relationize (
    {
      source: {
        paths: [
          {
            namespace: 'relationizeTest',
            path: '/somewhere/json-schemas/live'
          }
        ]
      }
    },
    function (err, dbStructure) {
      // Done!
      // - The value of 'dbStructure' takes the same form  
      //   as the output generated by the 'pg-info' package.
    }
  )

API

relationize(options, callback)

Options:

OptionTypeNotes
sourceobjectA source object for configuring where to derive JSON Schema data from.

source object

Examples

  • From files:
{
  paths: [
    {
      namespace: 'relationizeTest',
      path: '/somewhere/json-schemas/live'
    }
  ]
}
  • From Javascript object:
{
  schemas: [
    {
      namespace: 'relationizeTest',
      schema: {
        // JSON schema here
      }
    }
  ]
}

Properties

propertyTypeNotes
paths[object]An array of objects containing a namespace property (used to separate related tables into schemas_ and path (a file-path from where to load JSON files from - uses glob, so the ** pattern is supported)
schemas[object]An array of objects containing a namespace property (used to separate related tables into schemas_ and schema (a ready-to-use JSON Schema)

Output

Relationize returns objects of the same form as those returned by the pg-info package. The output of Relationize can then be used to generate a relational database (complete with comments, tables, indexes and foreign key constraints) to store your JSON-structured data.

Testing

$ npm test

License

MIT

0.0.19

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago