Skip to content

Commit

Permalink
Merge pull request #95 from treegex/dev
Browse files Browse the repository at this point in the history
Version 2.0.6
  • Loading branch information
TREER00T authored Jan 6, 2023
2 parents 30dc987 + e0d1f82 commit 219255a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Project exclude paths
/node_modules/
.idea
.dist
/dist/
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CHANGELOG
CHANGELOG.md
docs
jest.config.ts
.dist
dist/test
.idea
CONTRIBUTING.md
lib/sql-parser/test
7 changes: 7 additions & 0 deletions CHANGELOG/2.x/CHNAGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log
==========

## Version 2.0.6

2023-1-6

* Fixed some issue in import package
* Replaced import to require function in driver factory

## Version 2.0.2

2023-1-1
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "opensql",
"version": "2.0.2",
"version": "2.0.6",
"description": "OpenSql is a promise-based Node.js ORM tool for MySql, Postgres and Microsoft Sql Server",
"main": "dist/index.js",
"scripts": {
"prestart": "tsc index.ts --outDir .dist",
"start": "node .dist/index.js",
"build": "tsc --module CommonJS --outDir dist",
"prestart": "tsc --outDir dist",
"start": "node dist/index.js",
"build": "tsc --outDir dist",
"test": "jest",
"sql-parser-run": "nodemon ./lib/sql-parser/index.js"
},
Expand Down
22 changes: 10 additions & 12 deletions src/common/db/DatabaseFactory.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import {CreateTable, FilterWithId, Query, TargetTable} from '../../../package/type/db/Query';
import DismissConnection from './DismissConnection';
import DriverConnection from './DriverConnection';
import Postgresql from '../../driver/postgresql';
import Mysql from '../../driver/mysql';
import Util from '../../util/Util';
import Database from './Database';

const Utilities = Util.getInstance(),
instanceClass = {
mysql: Mysql,
postgresql: Postgresql
};
// @ts-ignore
declare function require(name: string);

const Utilities = Util.getInstance();


export default class DatabaseFactory implements DismissConnection, Database {

private driver: DriverConnection;
private driver: any;


protected factory(str: string) {
// @ts-ignore
this.driver = new instanceClass[Utilities.getDriverNameFromString(str)]();
let instanceClass = require(`../../driver/${Utilities.getDriverNameFromString(str)}`);

this.driver = new instanceClass.default;
}

constructor(url: string, option?: object) {
this.factory(url);
this.factory(url)
this.connect(url, option);
}

Expand Down

0 comments on commit 219255a

Please sign in to comment.