added experimental duration functions

pull/469/head
Scott Anderson 2019-09-16 16:10:24 -06:00
parent d772e5096d
commit cb5fb6e848
7 changed files with 121 additions and 5 deletions

View File

@ -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. Experimental functions are subject to change at any time and are not recommended for production use.
{{% /warn %}} {{% /warn %}}
## Experimental functions
{{< children type="functions" show="pages" >}} {{< children type="functions" show="pages" >}}
{{< children >}} ## Experimental packages
{{< children show="sections" >}}

View File

@ -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
```

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: Bigtable name: Bigtable
parent: Experimental parent: Experimental
weight: 202 weight: 201
v2.0/tags: [functions, bigtable, package, google] v2.0/tags: [functions, bigtable, package, google]
--- ---

View File

@ -6,7 +6,7 @@ menu:
v2_0_ref: v2_0_ref:
name: bigtable.from name: bigtable.from
parent: Bigtable parent: Bigtable
weight: 202 weight: 301
--- ---
The `bigtable.from()` function retrieves data from a [Google Cloud Bigtable](https://cloud.google.com/bigtable/) The `bigtable.from()` function retrieves data from a [Google Cloud Bigtable](https://cloud.google.com/bigtable/)

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: MQTT name: MQTT
parent: Experimental parent: Experimental
weight: 202 weight: 201
v2.0/tags: [functions, mqtt, package] v2.0/tags: [functions, mqtt, package]
--- ---

View File

@ -6,7 +6,7 @@ menu:
v2_0_ref: v2_0_ref:
name: mqtt.to name: mqtt.to
parent: MQTT parent: MQTT
weight: 202 weight: 301
--- ---
The `mqtt.to()` function outputs data to an MQTT broker using MQTT protocol. The `mqtt.to()` function outputs data to an MQTT broker using MQTT protocol.

View File

@ -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
```