-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Support simultanous name and group tags #381
Open
jquirke
wants to merge
3
commits into
uber-go:master
Choose a base branch
from
jquirke:dig_380
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
jquirke
changed the title
Support simultanous name and group tags
[WIP] Support simultanous name and group tags
Mar 6, 2023
jquirke
commented
Mar 6, 2023
jquirke
commented
Mar 6, 2023
jquirke
force-pushed
the
dig_380
branch
2 times, most recently
from
March 6, 2023 07:50
660e806
to
4541e57
Compare
jquirke
commented
Mar 9, 2023
jquirke
force-pushed
the
dig_380
branch
3 times, most recently
from
March 9, 2023 07:55
f3d07ad
to
09b8db4
Compare
As per Dig issue: uber-go#380 In order to support Fx feature requests uber-go/fx#998 uber-go/fx#1036 We need to be able to drop the restriction, both in terms of options dig.Name and dig.Group and dig.Out struct annotations on `name` and `group` being mutually exclusive. In a future PR, this can then be exploited to populate value group maps where the 'name' tag becomes the key of a map[string][T]
As part of uber-go#380 we allowed names and groups tags/options to co-exist to ultimately support Fx feature request uber-go/fx#998. We now intend to support Map value groups as per uber-go/fx#1036. We will do this in 2 steps. 1. This PR will begin tracking any names passed into value groups with out changing any external facing functionality. 2. a subsequent PR will exploit this structure to support Map value groups.
jquirke
force-pushed
the
dig_380
branch
2 times, most recently
from
March 19, 2023 22:33
91f0661
to
5a24c26
Compare
This revision allows dig to specify value groups of map type. For example: ``` type Params struct { dig.In Things []int `group:"foogroup"` MapOfThings map[string]int `group:"foogroup"` } type Result struct { dig.Out Int1 int `name:"foo1" group:"foogroup"` Int2 int `name:"foo2" group:"foogroup"` Int3 int `name:"foo3" group:"foogroup"` } c.Provide(func() Result { return Result{Int1: 1, Int2: 2, Int3: 3} }) c.Invoke(func(p Params) { }) ``` p.Things will be a value group slice as per usual, containing the elements {1,2,3} in an arbitrary order. p.MapOfThings will be a key-value pairing of {"foo1":1, "foo2":2, "foo3":3}.
jquirke
changed the title
[WIP] Support simultanous name and group tags
Support simultanous name and group tags
Mar 19, 2023
jquirke
changed the title
Support simultanous name and group tags
[WIP] Support simultanous name and group tags
Mar 20, 2023
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.
As per Dig issue:
#380
In order to support Fx feature requests
uber-go/fx#998
uber-go/fx#1036
We need to be able to drop the restriction, both in terms of options dig.Name and dig.Group and dig.Out struct annotations on
name
andgroup
being mutually exclusive.In a shortly upcoming PR, this can then be exploited to populate value group maps where the 'name' tag becomes the key of a map[string][T]
For now, please do not merge.