INNER CODE UNIT · Python

setup_mediator_factory

SamWarden/user_service · src/user_service/main/di/main.py:49

def setup_mediator_factory(
    di_builder: DiBuilder,
    mediator_factory: DependencyProviderType,
    scope: Scope,
) -> None:
    di_builder.bind(bind_by_type(Dependent(mediator_factory, scope=scope), Mediator))
    di_builder.bind(bind_by_type(Dependent(mediator_factory, scope=scope), QueryMediator))
    di_builder.bind(bind_by_type(Dependent(mediator_factory, scope=scope), CommandMediator))
    di_builder.bind(bind_by_type(Dependent(mediator_factory, scope=scope), EventMediator))


def setup_db_factories(
    di_builder: DiBuilder, db_engine: AsyncEngine, session_factory: async_sessionmaker[AsyncSession]
) -> None:
    di_builder.bind(bind_by_type(Dependent(lambda *args: db_engine, scope=DiScope.APP), AsyncEngine))
    di_builder.bind(
        bind_by_type(
            Dependent(lambda *args: session_factory, scope=DiScope.APP),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…