golang reflection

1. what is reflection
Reflection is the ability of a program to inspect its variables and values at run time and find their type.
2. why use reflection
before program run, variable type and value are uncertain
```go
func createQuery(q interface{}) string {
}
```
3.after use reflection
```go
func createQuery(q interface{}) {
t := reflect.TypeOf(q)
v := reflect.ValueOf(q)
fmt.Println("

golang reflection最先出现在Python成神之路

版权声明:
作者:admin
链接:https://www.techfm.club/p/12357.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>