File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,29 @@ The classes provide some common use methods:
2929* ` paginated_find ` : Search for a list of models, with pagination support
3030* ` cursor_paginated_find ` : Search for a list of models, with cursor based pagination support
3131
32+ /// details | Typing and Protocols
33+ type: tip
34+
35+ The repository classes are fully typed (as the rest of this package), but
36+ protocols classes are provided as addition to allow more decoupled type checking
37+ and inversion of control patterns such as
38+ [ dependency injection] ( https://en.wikipedia.org/wiki/Dependency_injection ) .
39+
40+ ``` python
41+ from sqlalchemy_bind_manager.protocols import SQLAlchemyRepositoryInterface, SQLAlchemyAsyncRepositoryInterface
42+
43+ def some_function (repository : SQLAlchemyRepositoryInterface[MyModel]):
44+ model = repository.get(123 )
45+ ...
46+
47+ async def some_async_function (repository : SQLAlchemyAsyncRepositoryInterface[MyModel]):
48+ model = await repository.get(123 )
49+ ...
50+ ```
51+
52+ Both repository and related protocols are Generic, accepting the model class as argument.
53+ ///
54+
3255### Maximum query limit
3356
3457Repositories have a maximum limit for paginated queries defaulting to 50 to
You can’t perform that action at this time.
0 commit comments