dbgate/plugins/dbgate-plugin-csv
dependabot[bot] ef25ea1885
Bump lodash from 4.17.15 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-16 12:00:59 +00:00
..
src added plugins 2021-04-13 16:17:53 +02:00
icon.svg added plugins 2021-04-13 16:17:53 +02:00
LICENSE added plugins 2021-04-13 16:17:53 +02:00
package.json Bump lodash from 4.17.15 to 4.17.21 2021-05-16 12:00:59 +00:00
prettier.config.js added plugins 2021-04-13 16:17:53 +02:00
README.md removed paypal links 2021-04-19 17:55:16 +02:00
webpack-backend.config.js added plugins 2021-04-13 16:17:53 +02:00
webpack-frontend.config.js added plugins 2021-04-13 16:17:53 +02:00

styled with prettier NPM version

dbgate-plugin-csv

CSV import/export plugin for DbGate

Usage without DbGate

Export from fake object reader into CSV file. Fake object file can be replaced with other reader/writer factory functions, as described in dbgate-api package

const dbgateApi = require('dbgate-api');
const dbgatePluginCsv = require("dbgate-plugin-csv");

dbgateApi.registerPlugins(dbgatePluginCsv);


async function run() {
  const reader = await dbgateApi.fakeObjectReader();
  const writer = await dbgatePluginCsv.shellApi.writer({ fileName: 'myfile1.csv', separator: ';' });
  await dbgateApi.copyStream(reader, writer);
  
  console.log('Finished job script');
}
dbgateApi.runScript(run);


Factory functions

shellApi.reader

Reads CSV file

  const dbgatePluginCsv = require("dbgate-plugin-csv");
  const reader = await dbgatePluginCsv.shellApi.reader({
    fileName: 'test.csv',
    encoding: 'utf-8',
    header: true,
    delimiter: ',',
    quoted: false,
    limitRows: null
  });

shellApi.writer

Writes CSV file

  const dbgatePluginCsv = require("dbgate-plugin-csv");
  const writer = await dbgatePluginCsv.shellApi.writer({
    fileName: 'test.csv',
    encoding: 'utf-8',
    header: true,
    delimiter: ',',
    quoted: false
  });