mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 00:16:00 +00:00
api documentation WIP
This commit is contained in:
@@ -2,6 +2,13 @@ const EnsureStreamHeaderStream = require('../utility/EnsureStreamHeaderStream');
|
||||
const Stream = require('stream');
|
||||
const ColumnMapTransformStream = require('../utility/ColumnMapTransformStream');
|
||||
|
||||
/**
|
||||
* Copies reader to writer. Used for import, export tables and transfer data between tables
|
||||
* @param {readerType} input - reader object
|
||||
* @param {writerType} output - writer object
|
||||
* @param {object} options - options
|
||||
* @returns {Promise}
|
||||
*/
|
||||
function copyStream(input, output, options) {
|
||||
const { columns } = options || {};
|
||||
|
||||
|
||||
@@ -33,6 +33,14 @@ class ParseStream extends stream.Transform {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reader function, which reads JSNOL file or URL. JSONL format - text file, every line is JSON encoded row.
|
||||
* @param {Object} options
|
||||
* @param {string} options.fileName - file name or URL
|
||||
* @param {string} options.encoding - encoding of the file
|
||||
* @param {number} options.limitRows - maximum number of rows to read
|
||||
* @returns {Promise<readerType>} - reader object
|
||||
*/
|
||||
async function jsonLinesReader({ fileName, encoding = 'utf-8', limitRows = undefined }) {
|
||||
logger.info(`Reading file ${fileName}`);
|
||||
|
||||
|
||||
12
packages/api/src/shell/types.js
Normal file
12
packages/api/src/shell/types.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Reader (input) object for copyStream function
|
||||
* @typedef {Object} readerType
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrtiter (output) object for copyStream function
|
||||
* @typedef {Object} writerType
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user