我正在從這樣的代碼中查詢inlfluxdb數據庫。如何處理從代碼查詢influxdb數據庫獲得的結果
q := fmt.Sprintf("select step,timeTaken from ZtpBoot where cvpVersion =
2017.1.1 group by step,numberOfDevices"
res, _ := queryDB(clnt, q)
Result when executing query in influxdb is like:-
name: ZtpBoot
tags: numberOfDevices=2, step=Step3.verifyZtpViaPost
time step timeTaken
---- ---- ---------
1495540747000000000 Step3.verifyZtpViaPost 0.108520030975
1495541643000000000 Step3.verifyZtpViaPost 0.115226984024
name: ZtpBoot
tags: numberOfDevices=2, step=Step4.verifyZtpViaHttp
time step timeTaken
---- ---- ---------
1495540747000000000 Step4.verifyZtpViaHttp 0.100101947784
1495541643000000000 Step4.verifyZtpViaHttp 0.103901863098
我如何處理從res,_:= queryDB(clnt,q)獲取的res以顯示如表中所示的結果。
yes我看着它,但我不能得到我想要的輸出:(。 – supriya
當你運行'fmt.Printf(「Res:%v \ nType:%T \ n」, res,res)'? – jrefior
我得到了這個 - > Res:[{[{ZtpBoot map [numberOfDevices:1 step:Step1.dhcpSetupTime] [time step timeTaken] [[2017-05-16T10:09:44Z Step1.dhcpSetupTime [2017-05-16] [2017-05-16 \ T10:17:14Z Step1.dhcpSetupTime 0.893213033676] [2017-05-16T10:24:44Z Step1.dhcpSetupTime 0.476826906204] [2017-05-16T10:32:17Z Step1.dhcpSetupTime 0.80868196 \ 4874] [2017-05-16T10:42:39Z Step1.dhcpSetupTime 0.484630823135] [2017-05-23T12:14:03Z totalRunTime 4 \ 19.631438017]] false}] []}] 類型:[] client.Result – supriya