-
Notifications
You must be signed in to change notification settings - Fork 677
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: