From c38d16dc28d339da119050cd65af3f17019c047a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 23 Aug 2024 18:30:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=BB=93=E6=9E=84=E4=BD=93,?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=8F=AF=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dynamic_struct.go | 1 + 1 file changed, 1 insertion(+) 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) }