Skip to content
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

Fail on conflict #46

Closed
the4thamigo-uk opened this issue Oct 18, 2017 · 3 comments
Closed

Fail on conflict #46

the4thamigo-uk opened this issue Oct 18, 2017 · 3 comments

Comments

@the4thamigo-uk
Copy link

the4thamigo-uk commented Oct 18, 2017

I can see that mergo merges when the destination is non-zero and that there is also a forced overwrite option, but I have a use case where I want to report an error (and abort the merge), if an attempt is made to merge a field that already is non-zero in the destination object. I'd like to submit a PR to support this behaviour. Do you agree that this is useful?

@darccio
Copy link
Owner

darccio commented Oct 19, 2017

It's an interesting idea. Something like TryMerge or MustMerge could be a good name for this behavior.

@darccio
Copy link
Owner

darccio commented Jan 11, 2018

As #49 has been merged, we can implement this easily. I was thinking how to call it and I would go for CleanMerge (as in clean shot). It only would fail if Merge finds a non-zero attribute in destination and the source attribute isn't zero.

@darccio
Copy link
Owner

darccio commented Apr 2, 2018

@the4thamigo-uk, what do you think about my previous comment? I would love to have feedback about how to call it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants