Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

@wmfs/pg-delta-file

1.27.0 • Public • Published

pg-delta-file

Tymly Package npm (scoped) Build Status codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

Outputs change-only-update CSV files (or “delta” files) that contain all the necessary actions required to re-synchronize rows in a cloned table.

Usage

const generateDeltaFile = require('pg-delta-file')

await generateDeltaFiles(
  since: '2017-07-16T20:37:26.847Z',
  outputFilepath: '/some/temp/dir/people-delta.csv',
  actionAliases: {
    insert: 'u',
    update: 'u',
    delete: 'd'
  },
  createdColumnName: '_created',
  modifiedColumnName: '_modified',
  transformFunction: (row, callback) => { ... } // optional data transformation
  filterFunction: (row) => { ... } // option filter predicate
  csvExtracts: {
    '[schema.]people': [
      'PERSON', // Just output a literal
      '$ACTION', // Will output 'u' or 'd'
      '$ROW_NUM', // Row counter
      '@social_security_id', /// Column data
      '@first_name',
      '@last_name',
      '@age'
      '$DATESTAMP',
      '$TIMESTAMP',
      '$DATETIMESTAMP',
    ],
    '[schema2.]address': [
      ...
    ]
  }
)

Install

$ npm install pg-delta-file --save

License

MIT

install

npm i @wmfs/pg-delta-file

Downloadsweekly downloads

878

version

1.27.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability