Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for reuse (0.28 sec)

  1. docs/en/docs/how-to/sql-databases-peewee.md

    So, in our case, if we set the Peewee state variable (with a default `dict`) in the `async` dependency, all the rest of the internal code in our app will see this value and will be able to reuse it for the whole request.
    
    And the context variable would be set again for the next request, even if they are concurrent.
    
    ### Set database state in the dependency `get_db()`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (0)
  2. docs/en/docs/release-notes.md

    Now you can create an annotated dependency once, like this:
    
    ```Python
    CurrentUser = Annotated[User, Depends(get_current_user)]
    ```
    
    And then you can reuse this `Annotated` dependency:
    
    ```Python
    CurrentUser = Annotated[User, Depends(get_current_user)]
    
    
    @app.get("/items/")
    def read_items(user: CurrentUser):
        ...
    
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 03 23:25:42 GMT 2024
    - 388.1K bytes
    - Viewed (1)
  3. docs/en/docs/tutorial/sql-databases.md

    {!../../../docs_src/sql_databases/sql_app/crud.py!}
    ```
    
    !!! tip
        By creating functions that are only dedicated to interacting with the database (get a user or an item) independent of your *path operation function*, you can more easily reuse them in multiple parts and also add <abbr title="Automated tests, written in code, that check if another piece of code is working correctly.">unit tests</abbr> for them.
    
    ### Create data
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
Back to top