mirror of
https://github.com/knex/knex.git
synced 2025-06-26 22:00:25 +00:00
Commit compiled files
This commit is contained in:
parent
6243f6cbd5
commit
ca3dd19f4f
34
index.js
Normal file
34
index.js
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.getDialectByNameOrAlias = void 0;
|
||||
const { resolveClientNameWithAliases } = require('../util/helpers');
|
||||
const dbNameToDialectLoader = Object.freeze({
|
||||
'better-sqlite3': () => require('./better-sqlite3'),
|
||||
cockroachdb: () => require('./cockroachdb'),
|
||||
mssql: () => require('./mssql'),
|
||||
mysql: () => require('./mysql'),
|
||||
mysql2: () => require('./mysql2'),
|
||||
oracle: () => require('./oracle'),
|
||||
oracledb: () => require('./oracledb'),
|
||||
pgnative: () => require('./pgnative'),
|
||||
postgres: () => require('./postgres'),
|
||||
redshift: () => require('./redshift'),
|
||||
sqlite3: () => require('./sqlite3'),
|
||||
});
|
||||
/**
|
||||
* Gets the Dialect object with the given client name or throw an
|
||||
* error if not found.
|
||||
*
|
||||
* NOTE: This is a replacement for prior practice of doing dynamic
|
||||
* string construction for imports of Dialect objects.
|
||||
*/
|
||||
function getDialectByNameOrAlias(clientName) {
|
||||
const resolvedClientName = resolveClientNameWithAliases(clientName);
|
||||
const dialectLoader = dbNameToDialectLoader[resolvedClientName];
|
||||
if (!dialectLoader) {
|
||||
throw new Error(`Invalid clientName given: ${clientName}`);
|
||||
}
|
||||
return dialectLoader();
|
||||
}
|
||||
exports.getDialectByNameOrAlias = getDialectByNameOrAlias;
|
||||
//# sourceMappingURL=index.js.map
|
3
lib/.gitignore
vendored
3
lib/.gitignore
vendored
@ -5,6 +5,3 @@
|
||||
|
||||
# Do not include tsc source maps
|
||||
**/*.js.map
|
||||
|
||||
# Do not include .js files from .ts files
|
||||
dialects/index.js
|
||||
|
34
lib/dialects/index.js
Normal file
34
lib/dialects/index.js
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.getDialectByNameOrAlias = void 0;
|
||||
const { resolveClientNameWithAliases } = require('../util/helpers');
|
||||
const dbNameToDialectLoader = Object.freeze({
|
||||
'better-sqlite3': () => require('./better-sqlite3'),
|
||||
cockroachdb: () => require('./cockroachdb'),
|
||||
mssql: () => require('./mssql'),
|
||||
mysql: () => require('./mysql'),
|
||||
mysql2: () => require('./mysql2'),
|
||||
oracle: () => require('./oracle'),
|
||||
oracledb: () => require('./oracledb'),
|
||||
pgnative: () => require('./pgnative'),
|
||||
postgres: () => require('./postgres'),
|
||||
redshift: () => require('./redshift'),
|
||||
sqlite3: () => require('./sqlite3'),
|
||||
});
|
||||
/**
|
||||
* Gets the Dialect object with the given client name or throw an
|
||||
* error if not found.
|
||||
*
|
||||
* NOTE: This is a replacement for prior practice of doing dynamic
|
||||
* string construction for imports of Dialect objects.
|
||||
*/
|
||||
function getDialectByNameOrAlias(clientName) {
|
||||
const resolvedClientName = resolveClientNameWithAliases(clientName);
|
||||
const dialectLoader = dbNameToDialectLoader[resolvedClientName];
|
||||
if (!dialectLoader) {
|
||||
throw new Error(`Invalid clientName given: ${clientName}`);
|
||||
}
|
||||
return dialectLoader();
|
||||
}
|
||||
exports.getDialectByNameOrAlias = getDialectByNameOrAlias;
|
||||
//# sourceMappingURL=index.js.map
|
@ -194,7 +194,8 @@ class Client_PG extends Client {
|
||||
|
||||
return new Promise(function (resolver, rejecter) {
|
||||
const queryStream = connection.query(
|
||||
new PGQueryStream(sql, obj.bindings, options), err => {
|
||||
new PGQueryStream(sql, obj.bindings, options),
|
||||
(err) => {
|
||||
rejecter(err);
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user