@dbml/connector
Version:
This package was created to fetch the schema JSON from many kind of databases.
26 lines (25 loc) • 1.11 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchSchemaJson = void 0;
const postgresConnector_1 = require("./postgresConnector");
const mssqlConnector_1 = require("./mssqlConnector");
const mysqlConnector_1 = require("./mysqlConnector");
const snowflakeConnector_1 = require("./snowflakeConnector");
const bigqueryConnector_1 = require("./bigqueryConnector");
const fetchSchemaJson = async (connection, databaseType) => {
switch (databaseType) {
case 'postgres':
return (0, postgresConnector_1.fetchSchemaJson)(connection);
case 'mssql':
return (0, mssqlConnector_1.fetchSchemaJson)(connection);
case 'mysql':
return (0, mysqlConnector_1.fetchSchemaJson)(connection);
case 'snowflake':
return (0, snowflakeConnector_1.fetchSchemaJson)(connection);
case 'bigquery':
return (0, bigqueryConnector_1.fetchSchemaJson)(connection);
default:
throw new Error(`Unsupported database type: ${databaseType}`);
}
};
exports.fetchSchemaJson = fetchSchemaJson;
;