-
Notifications
You must be signed in to change notification settings - Fork 158
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
Support for merging slices #269
Comments
Can you give an example with some pseudocode illustrating what you're referring to? |
Take this struct for example:
Assume you have 2 "Parent" structs you would like to merge.
Intended result:
However, as is known, koanf will simply replace slice values rather than append them.
The suggestion/request is to have something like
As a result, you would only need to write the code to handle slices and rely on the default merging algorithm for anything else. WDYT? Inspired from another library I had seen:
|
Closing this in favour of: #299 (comment) |
As of today, the library works in most scenarios, but it has one annoying downside; it doesn't support slices.
At least not in the way you'd expect like merging them.
The library does support adding a custom merge function, but it's not scoped and you end up writing the entire merge algorithm. Another library I came across had the ability to define merge functions for certain types. In which case, you could provide a merge function for Slices and rely on the default behavior for everything else.
Any chance this library can be improved by adding scoped merge functions? Are there any workarounds that can be employed to end up merging slices?
The text was updated successfully, but these errors were encountered: