选项
选项表示指定类型的任何值的存储位置。
选项是可变的。
在其生命周期中,选项可以持有不同的值。
以下是目前在Flux语言中实现的内置选项的列表:
选项没有被关闭,这意味着可以在包和脚本中定义和使用新选项。 为一个包更改选项的值会更改所有其他包对该选项的引用的值。
现在
选项 now 是一个函数,返回一个时间值,用作当前系统时间的代理。
// Query should execute as if the below time is the current system time
option now = () => 2006-01-02T15:04:05-07:00
任务
任务
option task = {
name: "foo", // Name is required.
every: 1h, // Task should be run at this interval.
offset: 10m, // Delay scheduling this task by this duration.
cron: "0 2 * * *", // Cron is a more sophisticated way to schedule. 'every' and 'cron' are mutually exclusive.
}
位置
选项 location 设置脚本中所有时间的默认时区。该位置映射给定时间的UTC偏移。默认值为 timezone.utc。
import "timezone"
// Set timezone to be 5 hours west of UTC
option location = timezone.fixed(offset: -5h)
// Set location to be America/Denver
option location = timezone.location(name: "America/Denver")
该 location 选项仅影响用于窗口的边界,特别是在时间偏移(如夏令时)周围。它不会改变 _time 列中的时间戳,这些时间戳始终是 UTC。