UNPKG

node-jt400

Version:
18 lines 551 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toInsertSql = toInsertSql; function recordToValues(record) { const str = Object.keys(record) .map(() => '?') .join(', '); return '(' + str + ')'; } function toInsertSql(tableName, records) { const first = records[0]; const keys = Object.keys(first); const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES${records .map(recordToValues) .join(', ')}`; return sql; } //# sourceMappingURL=sqlutil.js.map