- utils_reflect
This commit is contained in:
24
utils/utils_reflect_test.go
Normal file
24
utils/utils_reflect_test.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user