mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 09:36:01 +00:00
added plugins
This commit is contained in:
26
plugins/dbgate-plugin-excel/src/backend/index.js
Normal file
26
plugins/dbgate-plugin-excel/src/backend/index.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const xlsx = require('xlsx');
|
||||
const reader = require('./reader');
|
||||
const writer = require('./writer');
|
||||
|
||||
let dbgateApi;
|
||||
|
||||
module.exports = {
|
||||
packageName: 'dbgate-plugin-excel',
|
||||
shellApi: {
|
||||
reader,
|
||||
writer,
|
||||
},
|
||||
|
||||
commands: {
|
||||
analyse: async ({ fileName }) => {
|
||||
const downloadedFile = await dbgateApi.download(fileName);
|
||||
const workbook = xlsx.readFile(downloadedFile, { bookSheets: true });
|
||||
return workbook.SheetNames;
|
||||
},
|
||||
},
|
||||
initialize(dbgateEnv) {
|
||||
dbgateApi = dbgateEnv.dbgateApi;
|
||||
writer.initialize(dbgateEnv);
|
||||
reader.initialize(dbgateEnv);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user