UNPKG

jh-common-dataaccess

Version:
28 lines (26 loc) 565 B
const moment = require('moment'); module.exports = class DatabaseHelper { constructor(config) { this.config = config; this.caselow = config.caselow || false; } connect() {} close() {} query() {} execute() {} translate() {} static datapager() {} print(msg) { if (this.config.debug) console.log(msg); } formatDate(date) { return moment(date).format('YYYY-MM-DD HH:mm:ss'); } /** * 包装字段,避免大小写敏感异常 * @param {*} field 表名/字段名 */ packCaseLow(field) { return this.caselow ? ` "${field}" ` : field; } };