本文整理匯總了Golang中net/http/httptest.Server.Format方法的典型用法代碼示例。如果您正苦於以下問題:Golang Server.Format方法的具體用法?Golang Server.Format怎麽用?Golang Server.Format使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net/http/httptest.Server
的用法示例。
在下文中一共展示了Server.Format方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
c := clients[0]
Expect(c["address"]).To(Equal(ts.URL))
})
It("gets datapoints", func() {
ts := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts, Value: 23.2})
time.Sleep(10 * time.Millisecond)
ts2 := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts2, Value: 23.4})
points, err := g.GetDataPoints("kitchen temperature", ts, ts2, 0, false)
Expect(err).To(BeNil())
Expect(len(points)).To(Equal(2))
p1 := points[0]
Expect(p1.Time.Format(time.RFC3339)).To(Equal(ts.Format(time.RFC3339)))
Expect(p1.Value).To(Equal(23.2))
p2 := points[1]
Expect(p2.Time.Format(time.RFC3339)).To(Equal(ts2.Format(time.RFC3339)))
Expect(p2.Value).To(Equal(23.4))
})
It("gets binary datapoints", func() {
ts := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts, Value: 0.0})
time.Sleep(10 * time.Millisecond)
ts2 := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts2, Value: 1.0})
points, err := g.GetDataPoints("kitchen temperature", ts, ts2, 0, true)
Expect(err).To(BeNil())