动态结构体,字段可导出
This commit is contained in:
parent
59ba4ebfa5
commit
c38d16dc28
@ -152,6 +152,7 @@ func (ds *DynamicStruct) AddStructField(field reflect.StructField) {
|
|||||||
if field.Tag == "" {
|
if field.Tag == "" {
|
||||||
field.Tag = reflect.StructTag(fmt.Sprintf(`json:"%v"`, field.Name))
|
field.Tag = reflect.StructTag(fmt.Sprintf(`json:"%v"`, field.Name))
|
||||||
}
|
}
|
||||||
|
field.Name = String(field.Name).SnakeCaseToCamel() // 转成大驼峰, 保证对外可访问
|
||||||
ds.structFieldList = append(ds.structFieldList, field)
|
ds.structFieldList = append(ds.structFieldList, field)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user