Options
An option represents a storage location for any value of a specified type. Options are mutable. An option can hold different values during its lifetime.
Below is a list of built-in options currently implemented in the Flux language:
now
The now
option is a function that returns a time value used as a proxy for the current system time.
// Query should execute as if the below time is the current system time
option now = () => 2006-01-02T15:04:05-07:00
task
The task
option schedules the execution of a Flux query.
option task = {
name: "foo", // Name is required.
every: 1h, // Task should be run at this interval.
delay: 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.
retry: 5, // Number of times to retry a failed query.
}
location
The location
option sets the default time zone of all times in the script.
The location maps the UTC offset in use at that location for a given time.
The default value is 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")
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, the following resources are available:
InfluxDB Cloud customers can contact InfluxData Support.