golang influxdb 客户端对数组或切片的响应

golang influxdb client response to array or slice

我有一个 go 程序可以通过 Influxdb 客户端查询 Influxdb。

函数查询数据库: https://github.com/influxdata/influxdb/tree/master/client#querying-data 通过

调用
resp, err := queryDB(c, "SELECT ip FROM events WHERE time >= '2016-10-24T00:00:00Z' AND time < '2016-10-24T01:00:00Z' ORDER BY time DESC")

当我做的时候

fmt.Printf("%s", resp)

我得到了类似的东西

[{[{events map[] [time ip] [[2016-10-24T00:12:12.123456Z 192.168.123.107] /*...and so on...*/ [2016-10-24T00:24:24.123456Z 192.168.123.103]]}] [] }]

如何获得由时间和 IP 地址组成的简单数组或切片?

好的,我知道了:

var myData [][]interface{} = make([][]interface{}, len(resp[0].Series[0].Values))
            for i, d := range resp[0].Series[0].Values {
                myData[i] = d
            }

fmt.Println("", myData[0]) //first element in slice
fmt.Println("", myData[0][0])
fmt.Println("", myData[0][1])

输出:

[2016-10-24T00:12:12.123456Z 192.168.123.107]
2016-10-24T00:12:12.123456Z
192.168.123.107