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
Default value #111
Comments
Hi this would be a quite usefull feature. |
I need this feature too. Is there any news? |
I'm still unsure if mapstructure should take on this additional scope. I usually pair mapstructure with a library such as https://github.com/mcuadros/go-defaults to solve this. Defaults on their own don't fit super well into the current implementatin of mapstructure because the lib only looks for matching fields based on the data, so we wouldn't even really see the fields marked with "default". So this would quire a considerably different implementation. I also just merged #183 which should enable this sort of functionality via hooks you may want to take a look at. You should be able to create a hook on structs that calls a defaults library (or does it manually). |
Hi,
is there a way to provide default values for an field?
Sth. like
The text was updated successfully, but these errors were encountered: