Skip to content

Commit

Permalink
Update factories.md
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-daly authored Dec 31, 2024
1 parent 6211d62 commit 820693e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/factories.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Factories

Factories are just Callables that can be return your dependency. Factories can be useful if you need to your implementation to be dynamic based on the context/state of your application or current dependencies in the graph.
Factories can also have dependencies.
Factories are just Callables that can be return the instance of your dependency. Factories can be useful if you need to your implementation to be evaluated dynamically based on the context/state of your application or current dependencies in the graph.
Factories can also have their dependencies.

## Function
The most basic factory is using a function
The most basic factory is a simple function.

```python

Expand Down Expand Up @@ -63,7 +63,7 @@ user = await repo.get_user(10)

## Generator

You can also use a generator as your factory callable.
You can also use a generator as your factory.
This enables you to run some teardown tasks then the scope or container is ending.

```python
Expand Down

0 comments on commit 820693e

Please sign in to comment.