使用golang的datadase/sql包进行mysql数据库查询,没有查询到结果时,返回值是多少
sqlStr := "select distinct domain from securitymanager.domainthreat where ip =?"
rows, err := db.Query(sqlStr, "222.73.219.63")
没有查询到数据时返回值:
- 返回的err为nil,没有查询到数据是正常的情况,不会报错
- rows不是nil!而是一个结构体的内存地址,比如
&{0xc042096080 0x4c89e0 0xc042078140 0x4ba8d0 0xc04203a1c0 { {0 0} 0 0 0 0} false <nil> []}
- rows结构体格式
type