From cb5fb6e848144b414543c9e7bc5032f5e88f2e11 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 16 Sep 2019 16:10:24 -0600 Subject: [PATCH] added experimental duration functions --- .../flux/stdlib/experimental/_index.md | 4 +- .../flux/stdlib/experimental/addduration.md | 57 +++++++++++++++++++ .../stdlib/experimental/bigtable/_index.md | 2 +- .../flux/stdlib/experimental/bigtable/from.md | 2 +- .../flux/stdlib/experimental/mqtt/_index.md | 2 +- .../flux/stdlib/experimental/mqtt/to.md | 2 +- .../flux/stdlib/experimental/subduration.md | 57 +++++++++++++++++++ 7 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 content/v2.0/reference/flux/stdlib/experimental/addduration.md create mode 100644 content/v2.0/reference/flux/stdlib/experimental/subduration.md diff --git a/content/v2.0/reference/flux/stdlib/experimental/_index.md b/content/v2.0/reference/flux/stdlib/experimental/_index.md index d5f086106..3b08a4d3e 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/_index.md +++ b/content/v2.0/reference/flux/stdlib/experimental/_index.md @@ -18,6 +18,8 @@ The Flux Experimental package includes experimental functions that perform vario Experimental functions are subject to change at any time and are not recommended for production use. {{% /warn %}} +## Experimental functions {{< children type="functions" show="pages" >}} -{{< children >}} +## Experimental packages +{{< children show="sections" >}} diff --git a/content/v2.0/reference/flux/stdlib/experimental/addduration.md b/content/v2.0/reference/flux/stdlib/experimental/addduration.md new file mode 100644 index 000000000..7aa42e40f --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/experimental/addduration.md @@ -0,0 +1,57 @@ +--- +title: experimental.addDuration() function +description: > + The `experimental.addDuration()` function adds a duration to a time value and + returns the resulting time. +menu: + v2_0_ref: + name: experimental.addDuration + parent: Experimental +weight: 201 +related: + - /v2.0/reference/flux/stdlib/experimental/subduration/ +--- + +The `experimental.addDuration()` function adds a duration to a time value and +returns a the resulting time value. + +_**Function type:** Transformation_ + +{{% warn %}} +The `experimental.addDuration()` function is currently experimental and is subject to change at any time. +This specific function will be removed once duration vectors are implemented. +See [influxdata/flux#413](https://github.com/influxdata/flux/issues/413). +{{% /warn %}} + +```js +import "experimental" + +experimental.addDuration( + d: 12h, + to: now(), +) +``` + +## Parameters + +### d +The duration to add. + +_**Data type: Duration**_ + +### to +The time to add the [duration](#d) to. + +## Examples + +### Add six hours to a timestamp +```js +import "experimental" + +experimental.addDuration( + d: 6h, + to: 2019-09-16T12:00:00Z, +) + +// Returns 2019-09-16T18:00:00.000000000Z +``` diff --git a/content/v2.0/reference/flux/stdlib/experimental/bigtable/_index.md b/content/v2.0/reference/flux/stdlib/experimental/bigtable/_index.md index 86e403171..b046221c9 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/bigtable/_index.md +++ b/content/v2.0/reference/flux/stdlib/experimental/bigtable/_index.md @@ -8,7 +8,7 @@ menu: v2_0_ref: name: Bigtable parent: Experimental -weight: 202 +weight: 201 v2.0/tags: [functions, bigtable, package, google] --- diff --git a/content/v2.0/reference/flux/stdlib/experimental/bigtable/from.md b/content/v2.0/reference/flux/stdlib/experimental/bigtable/from.md index 5daa64b7f..cc7fa15e2 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/bigtable/from.md +++ b/content/v2.0/reference/flux/stdlib/experimental/bigtable/from.md @@ -6,7 +6,7 @@ menu: v2_0_ref: name: bigtable.from parent: Bigtable -weight: 202 +weight: 301 --- The `bigtable.from()` function retrieves data from a [Google Cloud Bigtable](https://cloud.google.com/bigtable/) diff --git a/content/v2.0/reference/flux/stdlib/experimental/mqtt/_index.md b/content/v2.0/reference/flux/stdlib/experimental/mqtt/_index.md index 4ae78c53f..79441f15d 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/mqtt/_index.md +++ b/content/v2.0/reference/flux/stdlib/experimental/mqtt/_index.md @@ -8,7 +8,7 @@ menu: v2_0_ref: name: MQTT parent: Experimental -weight: 202 +weight: 201 v2.0/tags: [functions, mqtt, package] --- diff --git a/content/v2.0/reference/flux/stdlib/experimental/mqtt/to.md b/content/v2.0/reference/flux/stdlib/experimental/mqtt/to.md index fd794069d..3610a332b 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/mqtt/to.md +++ b/content/v2.0/reference/flux/stdlib/experimental/mqtt/to.md @@ -6,7 +6,7 @@ menu: v2_0_ref: name: mqtt.to parent: MQTT -weight: 202 +weight: 301 --- The `mqtt.to()` function outputs data to an MQTT broker using MQTT protocol. diff --git a/content/v2.0/reference/flux/stdlib/experimental/subduration.md b/content/v2.0/reference/flux/stdlib/experimental/subduration.md new file mode 100644 index 000000000..ceb574541 --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/experimental/subduration.md @@ -0,0 +1,57 @@ +--- +title: experimental.subDuration() function +description: > + The `experimental.subDuration()` function subtracts a duration from a time value and + returns a the resulting time value. +menu: + v2_0_ref: + name: experimental.subDuration + parent: Experimental +weight: 201 +related: + - /v2.0/reference/flux/stdlib/experimental/addduration/ +--- + +The `experimental.subDuration()` function subtracts a duration from a time value and +returns a the resulting time value. + +_**Function type:** Transformation_ + +{{% warn %}} +The `experimental.subDuration()` function is currently experimental and is subject to change at any time. +This specific function will be removed once duration vectors are implemented. +See [influxdata/flux#413](https://github.com/influxdata/flux/issues/413). +{{% /warn %}} + +```js +import "experimental" + +experimental.subDuration( + d: 12h, + from: now(), +) +``` + +## Parameters + +### d +The duration to subtract. + +_**Data type: Duration**_ + +### from +The time to subtract the [duration](#d) from. + +## Examples + +### Subtract six hours from a timestamp +```js +import "experimental" + +experimental.subDuration( + d: 6h, + from: 2019-09-16T12:00:00Z, +) + +// Returns 2019-09-16T06:00:00.000000000Z +```