mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 12:43:58 +00:00
tsfix
This commit is contained in:
5
packages/engines/index.d.ts
vendored
Normal file
5
packages/engines/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import types from "@dbgate/types";
|
||||||
|
|
||||||
|
export function getDriver(
|
||||||
|
connection: string | { engine: string }
|
||||||
|
): types.EngineDriver;
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
const mssql = require('./mssql');
|
const mssql = require("./mssql");
|
||||||
const mysql = require('./mysql');
|
const mysql = require("./mysql");
|
||||||
const postgres = require('./postgres');
|
const postgres = require("./postgres");
|
||||||
|
|
||||||
const drivers = {
|
const drivers = {
|
||||||
mssql,
|
mssql,
|
||||||
mysql,
|
mysql,
|
||||||
postgres,
|
postgres
|
||||||
}
|
};
|
||||||
|
|
||||||
/** @return {import('@dbgate/types').EngineDriver} */
|
/** @type {import('@dbgate/types').EngineDriver} */
|
||||||
function getDriver(connection) {
|
function getDriver(connection) {
|
||||||
if (_.isString(connection)) {
|
if (_.isString(connection)) {
|
||||||
return drivers[connection];
|
return drivers[connection];
|
||||||
@@ -20,6 +20,6 @@ function getDriver(connection) {
|
|||||||
return drivers[engine];
|
return drivers[engine];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(`Cannot extract engine from ${connection}`)
|
throw new Error(`Cannot extract engine from ${connection}`);
|
||||||
}
|
}
|
||||||
module.exports = getDriver;
|
module.exports = getDriver;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^0.1.0",
|
"@dbgate/types": "^0.1.0",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.149",
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"."
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user