connect later #11

Merged
jusax23 merged 2 commits from dev into main 2023-02-25 19:12:17 +01:00
Showing only changes of commit 871c4d6be7 - Show all commits

View file

@ -15,10 +15,10 @@ export class DB {
type: dbType; type: dbType;
mariaPool!: mariadb.Pool; mariaPool!: mariadb.Pool;
//pgPool!: pg.Pool; //pgPool!: pg.Pool;
constructor({ host, user, password, database, connectionLimit = 5, databaseType = dbType.mariadb }: { host: string, user: string, password: string, database: string, connectionLimit?: number, databaseType?: dbType }) { constructor({ host, user, password, database, port = 3306, connectionLimit = 5, databaseType = dbType.mariadb }: { host: string, user: string, password: string, database: string, port?: number, connectionLimit?: number, databaseType?: dbType }) {
this.type = databaseType; this.type = databaseType;
if (databaseType == dbType.mariadb) { if (databaseType == dbType.mariadb) {
this.mariaPool = mariadb.createPool({ host, user, password, database, connectionLimit, multipleStatements: true }); this.mariaPool = mariadb.createPool({ host, user, password, port, database, connectionLimit, multipleStatements: true });
this.handler = new Handler(this); this.handler = new Handler(this);
} }
/*else if (databaseType == dbType.postgres) { /*else if (databaseType == dbType.postgres) {