iamai.dependencies module¶
iamai dependency injection.
Implement dependency injection related functions.
- iamai.dependencies.Depends(dependency: Type[_T | AsyncContextManager[_T] | ContextManager[_T]] | Callable[[], AsyncGenerator[_T, None]] | Callable[[], Generator[_T, None, None]] | None = None, *, use_cache: bool = True) _T[source]¶
Subdependency decorator.
- Parameters:
dependency – dependency class. If not specified, it will be automatically determined based on the type annotation of the field.
use_cache – whether to use cache. Defaults to
True.
- Returns:
Returns the internal child dependency object.