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("
共有 0 条评论