💡 add depends example

This commit is contained in:
yanyongyu
2021-11-21 17:09:31 +08:00
parent 9a29966e2d
commit 23c237cb2a
2 changed files with 29 additions and 0 deletions

View File

@ -26,3 +26,18 @@ sidebarDepth: 0
* `use_cache: bool = True`: 是否使用缓存。默认为 `True`
```python
def depend_func() -> Any:
return ...
def depend_gen_func():
try:
yield ...
finally:
...
async def handler(param_name: Any = Depends(depend_func), gen: Any = Depends(depend_gen_func)):
...
```