"use strict";
/**
 * 车场镜像knex模块
 * @date 2022-03
 * @author 何华东
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.knexInstance = exports.generateMySqlKnexInstance = exports.config = void 0;
var Contants_1 = require("./Contants");
var mslib_1 = require("mslib");
var test_config = {
    connection: {
        host: '121.36.160.42',
        port: 3306,
        user: 'nkc_test',
        password: 'nkc_test_ZahJ5een',
        database: 'park_image',
        multipleStatements: true
    }
};
var prod_config = {
    connection: {
        host: '122.112.252.51',
        port: 33390,
        user: 'nostandar',
        password: 'Keytop@!#321',
        database: 'park_image_new',
        multipleStatements: true
    }
};
/**
 * 车场镜像knex配置
 */
exports.config = Contants_1.default.IS_PROD ? prod_config : test_config;
/**
 * 生成车场镜像knex实例
 * @param config
 * @returns
 */
function generateMySqlKnexInstance(config) {
    var defaults = {
        client: 'mysql2',
        pool: { min: 0, max: 10 },
        debug: Contants_1.default.IS_DEBUG,
        log: {
            warn: function (message) {
                mslib_1.logger.warn(message);
            },
            error: function (message) {
                mslib_1.logger.error(message);
            },
            deprecate: function (message) {
                mslib_1.logger.error(message);
            },
            debug: function (message) {
                mslib_1.logger.debug(message);
            },
        }
    };
    return require('knex')(Object.assign(defaults, config));
}
exports.generateMySqlKnexInstance = generateMySqlKnexInstance;
/**
 * 车场镜像knex实例
 */
exports.knexInstance = generateMySqlKnexInstance(exports.config);
//# sourceMappingURL=ParkImageKnex.js.map