// Package wrapper ... // // Description : wrapper ... // // Author : go_developer@163.com<白茶清欢> // // Date : 2024-08-21 17:56 package wrapper import ( "fmt" "github.com/mitchellh/mapstructure" "testing" ) func TestNewDynamic(t *testing.T) { instance := NewDynamic() instance.AddInt("Age", "age", "") instance.AddString("Name", "name", "") defaultVal := instance.ToStructDefaultValue() testMap := map[string]any{ "name": "白茶", "age": 18, } _ = mapstructure.Decode(testMap, &defaultVal) fmt.Println(defaultVal) }