mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 16:42:41 +08:00
名称转换
This commit is contained in:
@ -8,12 +8,12 @@ import (
|
||||
|
||||
func TestStructToMap(t *testing.T) {
|
||||
o := struct {
|
||||
Abc string
|
||||
UserName string
|
||||
InTagName string `json:"in_tag_name,omitempty"`
|
||||
KeepEmpty int
|
||||
OmitEmpty int `json:",omitempty"`
|
||||
}{
|
||||
Abc: "测试字段",
|
||||
UserName: "测试字段",
|
||||
InTagName: "具体名称",
|
||||
KeepEmpty: 0,
|
||||
OmitEmpty: 0,
|
||||
@ -22,4 +22,6 @@ func TestStructToMap(t *testing.T) {
|
||||
t.Log(structs.ToMap(o))
|
||||
t.Log(structs.ToMap(o, structs.IgnoreEmpty()))
|
||||
t.Log(structs.ToMap(o, structs.Omitempty()))
|
||||
t.Log(structs.ToMap(o, structs.Lcfirst()))
|
||||
t.Log(structs.ToMap(o, structs.Camel2Case()))
|
||||
}
|
||||
|
Reference in New Issue
Block a user