Skip to content

Commit

Permalink
better encapsulation of imports
Browse files Browse the repository at this point in the history
  • Loading branch information
SingingBush committed Oct 23, 2023
1 parent 4ac62c7 commit 7cf13b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 9 additions & 8 deletions source/config/context.d
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module eloquent.config.context;

import hibernated.session;
import poodinis.context : ApplicationContext;
import poodinis.container : RegistrationOption, DependencyContainer;
import poodinis.registration;
private import hibernated.core : SessionFactory, SessionFactoryImpl;

import vibe.core.log; // only the logger is needed
private import poodinis.context : ApplicationContext;
private import poodinis.container : RegistrationOption, DependencyContainer;
private import poodinis.registration;

import eloquent.config.properties, eloquent.config.database, eloquent.config.logging, eloquent.config.motd;
import eloquent.controllers;
import eloquent.services;
private import vibe.core.log; // only the logger is needed

private import eloquent.config.properties, eloquent.config.database, eloquent.config.logging, eloquent.config.motd;
private import eloquent.controllers;
private import eloquent.services;

class PoodinisContext : ApplicationContext {

Expand Down
7 changes: 5 additions & 2 deletions source/config/database.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module eloquent.config.database;

private import hibernated.core;
private import poodinis.autowire;
private import hibernated.core : Connection, ConnectionPoolDataSourceImpl, DataSource, Dialect, EntityMetaData, SchemaInfoImpl, Session, SessionFactoryImpl;

private import poodinis.autowire: Autowire;
private import vibe.core.log; // only the logger is needed

private import eloquent.config.properties;
Expand Down Expand Up @@ -37,6 +38,7 @@ class EloquentDatabaseImpl : EloquentDatabase {
final switch(dbType.toUpper) {
case "SQLITE":
version(USE_SQLITE) {
import hibernated.core : SQLiteDialect;
dataSource = createSQLiteDataSource();
dialect = new SQLiteDialect();
} else {
Expand All @@ -45,6 +47,7 @@ class EloquentDatabaseImpl : EloquentDatabase {
break;
case "MYSQL":
version(USE_MYSQL) {
import hibernated.core : MySQLDialect;
dataSource = createMySQLDataSource();
dialect = new MySQLDialect();
} else {
Expand Down

0 comments on commit 7cf13b7

Please sign in to comment.