-
-
Notifications
You must be signed in to change notification settings - Fork 271
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for "custom" transformer/merges #49
Conversation
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
I was thinking about doing something very similar to support issue #46. It would be nice to combine these ideas. I have some general thoughts on this PR though, especially in relation to making it more generic :
|
@the4thamigo-uk thx :)
Actually you could have only a single transformer that has all the logic.
I like that idea 馃懠
Right, but it uses variadic arguments (can be |
Well, ok it doesnt force you, but it implies that behaviour I think and it leads to a more constraints on the kind of rules you can write (and adds complexity). Also, you cant list a rule that is based on the types of both the source and destination types, unless everything is pushed into the transformer, so why not just have the transformer and forget about the list/slice. Personally I would go for simplicity...
This is true but this isn't sufficient to make it compatible. i.e. an existing client code could have stored the merge function in a value, but since the function types are now different it is a breaking change. |
Also #5 should be implementable with this change. |
I'll check your proposal this weekend. Thanks! |
Add support for "custom" transformer/merges
Although this is a backwards-compatibility breaking change, I think it adds flexibility to Mergo. I trust Docker's crew and the test looks solid, so it's in :) |
BTW, @vdemeester, please, could you add an example in README? Thanks! |
I'm not sure the name transformer is not the right one.
But on docker/cli#569 we need to have a way to merge specific types differently that the default. This PR聽does that, on top of #45 馃懠