generate.from() 函数
generate.from()
使用提供的参数值生成数据。
函数类型签名
(count: int, fn: (n: int) => int, start: A, stop: A) => stream[{_value: int, _time: time, _stop: time, _start: time}] where A: Timeable
更多信息,请参阅 函数类型签名。
参数
count
(必需) 要生成的行数。
fn
(必需) 用于生成值的函数。
该函数接受一个 n
参数,该参数表示行索引,对 n
进行操作,然后返回一个整数值。行使用从零开始的索引。
start
(必需) 生成值的起始时间范围。
stop
(必需) 生成值的结束时间范围。
示例
生成示例数据
import "generate"
generate.from(
count: 6,
fn: (n) => (n + 1) * (n + 2),
start: 2021-01-01T00:00:00Z,
stop: 2021-01-02T00:00:00Z,
)
此页内容是否对您有帮助?
感谢您的反馈!