DB: remove shared stuff, add singleton

Add Config class
This commit is contained in:
2024-01-28 22:36:38 -03:00
parent 297786133d
commit fbf487051e
5 changed files with 75 additions and 5 deletions

View File

@@ -24,17 +24,17 @@ class DB {
protected DataSource m_ds;
protected Connection m_conn;
shared this(DBSettings settings) {
this(DBSettings settings) {
this.m_settings = settings;
}
static shared(DB) getDB(DBSettings settings) {
static DB getDB(DBSettings settings) {
switch (settings.connector) {
case DBConnector.DB_PGSQL:
import db.pgsql;
debugF!"DB type is PostgreSQL";
return new shared PostgresDB(settings);
return new PostgresDB(settings);
default:
throw new Exception("DB not supported");