sheet-json-persister

0.10.1 • Public • Published

SheetJsonPersister Library

About

This is a library which provides persister to a Sequelize db conection for Json events representing worksheet rows

The library will create the DB schema and persist all events to the db connection.

The events are expected to conform this the following schema.

{
    table: 'Sheet Name',//A work sheet name
    schema: {
        'Column A': '[bigint],
        'Column B': '[real]
        'Column C': '[string]
    }
    rows: [{ //A row from the work sheet
        'Column A': 1,
        'Column B': 2.2,
        'Column C': 'test
    }]
}

Install

npm install SheetJsonPersister
yarn install SheetJsonPersister

How to use

import { SheetJsonPersister} from 'sheet-json-persister'
let event = { 
    table: 'Sheet1',
    schema: {
        'Column A': '[bigint],
        'Column B': '[real]
        'Column C': '[string]
    },
    rows: [{ 'Column A': 1, 'Column B': 1.1, 'Column C': 'test1', 'Column D': 1,'Column E': '1.1'  }]
}
let persister = SheetJsonPersister(sequelize)
await persister(event)

See the SheetJsonPersister unit test in the test directory for usage.

Readme

Keywords

none

Package Sidebar

Install

npm i sheet-json-persister

Repository

gitlab.com/

Weekly Downloads

4

Version

0.10.1

License

MIT

Unpacked Size

7.94 kB

Total Files

4

Last publish

Collaborators

  • philxceptionale