本文整理汇总了Golang中github.com/influxdata/influxdb/influxql.IteratorOptions.DerivativeInterval方法的典型用法代码示例。如果您正苦于以下问题:Golang IteratorOptions.DerivativeInterval方法的具体用法?Golang IteratorOptions.DerivativeInterval怎么用?Golang IteratorOptions.DerivativeInterval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/influxdata/influxdb/influxql.IteratorOptions
的用法示例。
在下文中一共展示了IteratorOptions.DerivativeInterval方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestIteratorOptions_DerivativeInterval_Default
func TestIteratorOptions_DerivativeInterval_Default(t *testing.T) {
opt := influxql.IteratorOptions{}
expected := influxql.Interval{Duration: time.Second}
actual := opt.DerivativeInterval()
if actual != expected {
t.Errorf("expected derivative interval to be %v, got %v", expected, actual)
}
}
示例2: TestIteratorOptions_DerivativeInterval_GroupBy
func TestIteratorOptions_DerivativeInterval_GroupBy(t *testing.T) {
opt := influxql.IteratorOptions{
Interval: influxql.Interval{
Duration: 10,
Offset: 2,
},
}
expected := influxql.Interval{Duration: 10}
actual := opt.DerivativeInterval()
if actual != expected {
t.Errorf("expected derivative interval to be %v, got %v", expected, actual)
}
}
示例3: TestIteratorOptions_DerivativeInterval_Call
func TestIteratorOptions_DerivativeInterval_Call(t *testing.T) {
opt := influxql.IteratorOptions{
Expr: &influxql.Call{
Name: "mean",
Args: []influxql.Expr{
&influxql.VarRef{Val: "value"},
&influxql.DurationLiteral{Val: 2 * time.Second},
},
},
Interval: influxql.Interval{
Duration: 10,
Offset: 2,
},
}
expected := influxql.Interval{Duration: 2 * time.Second}
actual := opt.DerivativeInterval()
if actual != expected {
t.Errorf("expected derivative interval to be %v, got %v", expected, actual)
}
}