package
0.0.0-20231208061952-f10d33120ced
Repository: https://github.com/liguoqinjim/go-labs.git
Documentation: pkg.go.dev
# README
example02,总结play009(读取)
注意点
- reflect.Type,和类型相关的都在这个里面找,比如有多少个字段,字段名称,字段类型是什么
- reflect.Value,和值相关的用这个。比如这个字段的值是多少
- struct和pointer在使用reflect的时候是不一样的。
FieldByName()
只能在struct使用。pointer的时候要用Elem()
Value
和Type
才有Kind()
方法,StructField
是没有的