feat: add a ProvideOptions method for di initialization (solve #51)#53
Open
matdurand wants to merge 1 commit into
Open
feat: add a ProvideOptions method for di initialization (solve #51)#53matdurand wants to merge 1 commit into
matdurand wants to merge 1 commit into
Conversation
ProvideOptions is used to have a method receive dependencies and return other dependencies to be registered. This is useful to do conditional factories that return a variable number of dependencies.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #53 +/- ##
==========================================
- Coverage 95.27% 88.41% -6.87%
==========================================
Files 16 17 +1
Lines 889 958 +69
==========================================
Hits 847 847
- Misses 30 98 +68
- Partials 12 13 +1 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ProvideOptions is used to have a method receive dependencies and return other dependencies to be registered. This is useful to do conditional factories that return a variable number of dependencies.
Once I get confirmation that the code looks good, I will add the tests and doc.
Another option would be to simplify by not using a separate method, but by changing the
Providemethod to handle the special case of a constructor returningdi.Optionor[]di.Option.