- utils_reflect

This commit is contained in:
gazebo
2019-05-24 16:43:21 +08:00
parent 8a5ef089d1
commit 96818a206e
2 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package utils
import (
"reflect"
"testing"
)
func TestReflect(t *testing.T) {
type SubXXXX struct {
IntData int
StrData string
}
type XXXX struct {
SubXXXX
A int
B string `json:"b"`
}
x := XXXX{}
typeX := reflect.TypeOf(x)
field := typeX.Field(0)
t.Log(IsFieldEmbedded(&field))
t.Log(Format4Output(GetStructObjNameIndex(&x, ""), false))
}