DiscofyAPI/node_modules/mariadb/callback.js

30 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2021-03-25 17:23:36 +01:00
'use strict';
const pkg = require('./package.json')
require('please-upgrade-node')(pkg)
const ConnectionCallback = require('./lib/connection-callback');
const PoolClusterCallback = require('./lib/pool-cluster-callback');
const PoolCallback = require('./lib/pool-callback');
const ConnOptions = require('./lib/config/connection-options');
const PoolOptions = require('./lib/config/pool-options');
const PoolClusterOptions = require('./lib/config/pool-cluster-options');
module.exports.version = require('./package.json').version;
module.exports.SqlError = require('./lib/misc/errors').SqlError;
module.exports.createConnection = function createConnection(opts) {
return new ConnectionCallback(new ConnOptions(opts));
};
exports.createPool = function createPool(opts) {
const options = new PoolOptions(opts);
const pool = new PoolCallback(options);
pool.initialize();
return pool;
};
exports.createPoolCluster = function createPoolCluster(opts) {
const options = new PoolClusterOptions(opts);
return new PoolClusterCallback(options);
};