mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-24 10:34:01 +03:00
19 lines
409 B
Python
19 lines
409 B
Python
|
"""User containers module."""
|
||
|
|
||
|
from dependency_injector import containers, providers
|
||
|
|
||
|
from . import entities, repositories
|
||
|
|
||
|
|
||
|
class UserContainer(containers.DeclarativeContainer):
|
||
|
|
||
|
database = providers.Dependency()
|
||
|
|
||
|
user = providers.Factory(entities.User)
|
||
|
|
||
|
user_repository = providers.Singleton(
|
||
|
repositories.UserRepository,
|
||
|
entity_factory=user.provider,
|
||
|
db=database,
|
||
|
)
|