Skip to content

Commit 785a803

Browse files
authored
document how to force a downstream provider to be included (#55)
1 parent 78bf9c3 commit 785a803

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc.go

+15
Original file line numberDiff line numberDiff line change
@@ -500,5 +500,20 @@ defines. Wrapper functions have a small runtime performance penalty, so if you
500500
have more than a couple of providers that need cleanup, it makes sense to include
501501
something like CleaningService.
502502
503+
Forcing inclusion
504+
505+
The normal direction of forced inclusion is that an upstream provider is required
506+
because a downstream provider uses a type produced by the upstream provider.
507+
508+
There are times when the relationship needs to be reversed. For example, a type
509+
gets modified by a downstream injector. The simplest option is to combine the providers
510+
into one function.
511+
512+
Another possibility is to mark the upstream provider with MustConsume and have it
513+
produce a type that is only consumed by the downstream provider.
514+
515+
Lastly, the providers can be grouped with Cluster so that they'll be included or
516+
excluded as a group.
517+
503518
*/
504519
package nject

0 commit comments

Comments
 (0)