Closed
Description
db.Query("select * from users where id>?", 1)
type of rows['id'] is uint8
db.Query("select * from users where id>1")
type of rows['id'] is int64
rs, _ := db.Query("select id from tasks where id> 1 limit 1")
//rs, er := db.Query("select id from tasks where id>? limit 1", 1)
for rs.Next() {
var i1 interface{}
rs.Scan(&i1)
switch t := i1.(type) {
case []uint8:
fmt.Println("[]uint8", string(t)) //when args is blank
case int:
fmt.Println("int")
case int64:
fmt.Println("int64") //when args is not blank
default:
fmt.Println("default", t)
}
fmt.Println(i1)
break
}