Skip to content

Commit

Permalink
document how to force a downstream provider to be included (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
muir authored Jan 20, 2023
1 parent 78bf9c3 commit 785a803
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,5 +500,20 @@ defines. Wrapper functions have a small runtime performance penalty, so if you
have more than a couple of providers that need cleanup, it makes sense to include
something like CleaningService.
Forcing inclusion
The normal direction of forced inclusion is that an upstream provider is required
because a downstream provider uses a type produced by the upstream provider.
There are times when the relationship needs to be reversed. For example, a type
gets modified by a downstream injector. The simplest option is to combine the providers
into one function.
Another possibility is to mark the upstream provider with MustConsume and have it
produce a type that is only consumed by the downstream provider.
Lastly, the providers can be grouped with Cluster so that they'll be included or
excluded as a group.
*/
package nject

0 comments on commit 785a803

Please sign in to comment.