diff --git a/dynamic_struct.go b/dynamic_struct.go index 904fe09..8e89604 100644 --- a/dynamic_struct.go +++ b/dynamic_struct.go @@ -152,6 +152,7 @@ func (ds *DynamicStruct) AddStructField(field reflect.StructField) { if field.Tag == "" { field.Tag = reflect.StructTag(fmt.Sprintf(`json:"%v"`, field.Name)) } + field.Name = String(field.Name).SnakeCaseToCamel() // 转成大驼峰, 保证对外可访问 ds.structFieldList = append(ds.structFieldList, field) }