Files
baseapi/utils/utils_reflect_test.go
2019-05-24 16:43:21 +08:00

25 lines
363 B
Go

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))
}