Skip to content

Commit

Permalink
Flux 0.186 (influxdata#4551)
Browse files Browse the repository at this point in the history
* Flux 0.186.0 release notes

* Flux 0.186.0 stdlib updates
  • Loading branch information
sanderson authored Oct 11, 2022
1 parent 95446f1 commit 7482b32
Show file tree
Hide file tree
Showing 14 changed files with 415 additions and 122 deletions.
17 changes: 17 additions & 0 deletions content/flux/v0.x/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---

## v0.186.0 [2022-10-11]

### Features
- Add [`dynamic.isType()` function](/flux/v0.x/stdlib/experimental/dynamic/istype/).
- Add [`dynamic.asArray()` function](/flux/v0.x/stdlib/experimental/dynamic/asarray/).
- Add JSON functions that work with dynamic values:
- [`dynamic.jsonParse()`](/flux/v0.x/stdlib/experimental/dynamic/jsonparse/)
- [`dynamic.jsonEncode()`](/flux/v0.x/stdlib/experimental/dynamic/jsonencode/)
- Add runtime support for member expressions and remove index support for dynamic values.
- Add [`iox.sql()` function](/flux/v0.x/stdlib/experimental/iox/sql/).

### Bug fixes
- Update the `toUInt()` test to use the correct conversion behavior.
- Prevent the Flux formatter from losing precision on float values.

---

## v0.185.0 [2022-10-03]

### Features
Expand Down
2 changes: 1 addition & 1 deletion content/flux/v0.x/stdlib/experimental/array/tostring.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Array of values to convert. Default is the piped-forward array (`<-`).
```js
import "experimental/array"

arr = [12.0, 1.23, NaN, 24.2]
arr = [12.0, 1.2300, NaN, 24.2]

array.toString(arr: arr)// Returns ["12.0", "1.2300", "NaN", "24.2"]

Expand Down
49 changes: 49 additions & 0 deletions content/flux/v0.x/stdlib/experimental/dynamic/asarray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: dynamic.asArray() function
description: >
`dynamic.asArray()` converts a dynamic value into an array of dynamic elements.
menu:
flux_0_x_ref:
name: dynamic.asArray
parent: experimental/dynamic
identifier: experimental/dynamic/asArray
weight: 201
flux/v0.x/tags: [type-conversions]
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/dynamic/dynamic.flux#L27-L27
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`dynamic.asArray()` converts a dynamic value into an array of dynamic elements.

The dynamic input value must be an array. If it is not an array, `dynamic.asArray()` returns an error.

##### Function type signature

```js
(<-v: dynamic) => [dynamic]
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### v

Dynamic value to convert. Default is the piped-forward value (`<-`).



70 changes: 70 additions & 0 deletions content/flux/v0.x/stdlib/experimental/dynamic/istype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: dynamic.isType() function
description: >
`dynamic.isType()` tests if a dynamic type holds a value of a specified type.
menu:
flux_0_x_ref:
name: dynamic.isType
parent: experimental/dynamic
identifier: experimental/dynamic/isType
weight: 201
flux/v0.x/tags: [types, tests]
introduced: 0.186.0
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/dynamic/dynamic.flux#L81-L81
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`dynamic.isType()` tests if a dynamic type holds a value of a specified type.



##### Function type signature

```js
(type: string, v: dynamic) => bool
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### v
({{< req >}})
Value to test.



### type
({{< req >}})
String describing the type to check against.

**Supported types**:
- string
- bytes
- int
- uint
- float
- bool
- time
- duration
- regexp
- array
- object
- function
- dictionary
- vector

50 changes: 50 additions & 0 deletions content/flux/v0.x/stdlib/experimental/dynamic/jsonencode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: dynamic.jsonEncode() function
description: >
`dynamic.jsonEncode()` converts a dynamic value into JSON bytes.
menu:
flux_0_x_ref:
name: dynamic.jsonEncode
parent: experimental/dynamic
identifier: experimental/dynamic/jsonEncode
weight: 201
flux/v0.x/tags: [type-conversions]
introduced: 0.186.0
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/dynamic/dynamic.flux#L54-L54
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`dynamic.jsonEncode()` converts a dynamic value into JSON bytes.



##### Function type signature

```js
(v: dynamic) => bytes
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### v
({{< req >}})
Value to encode into JSON.



51 changes: 51 additions & 0 deletions content/flux/v0.x/stdlib/experimental/dynamic/jsonparse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: dynamic.jsonParse() function
description: >
`dynamic.jsonParse()` takes JSON data as bytes and returns dynamic values.
menu:
flux_0_x_ref:
name: dynamic.jsonParse
parent: experimental/dynamic
identifier: experimental/dynamic/jsonParse
weight: 201
flux/v0.x/tags: [type-conversions]
introduced: 0.186.0
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/dynamic/dynamic.flux#L44-L44
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`dynamic.jsonParse()` takes JSON data as bytes and returns dynamic values.

JSON input is converted to dynamic-typed values which may be converted to
a statically typed value with `dynamic.asArray()` or casting functions in the `dynamic` package.

##### Function type signature

```js
(data: bytes) => dynamic
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### data
({{< req >}})
JSON data (as bytes) to parse.



10 changes: 5 additions & 5 deletions content/flux/v0.x/stdlib/experimental/http/requests/peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name

#### Output data

| body | duration | headers | statusCode |
| ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| body | duration | headers | statusCode |
| ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| {"age":48,"count":25082,"name":"natalie"} | 100000000 | [
Access-Control-Allow-Credentials: true,
Access-Control-Allow-Origin: *,
Expand All @@ -88,12 +88,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive,
Content-Length: 41,
Content-Type: application/json; charset=utf-8,
Date: Mon, 03 Oct 2022 21:20:22 GMT,
Date: Tue, 11 Oct 2022 19:13:40 GMT,
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 998,
X-Rate-Limit-Reset: 9578,
X-Request-Id: Fxqr53E2jz6yFf4AFNpR
X-Rate-Limit-Reset: 17180,
X-Request-Id: Fx0ZogLRpfOI_V8LUOhy
] | 200 |

{{% /expand %}}
Expand Down
56 changes: 56 additions & 0 deletions content/flux/v0.x/stdlib/experimental/iox/sql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: iox.sql() function
description: >
`iox.sql()` executes an SQL query against a bucket in an IOx storage node.
menu:
flux_0_x_ref:
name: iox.sql
parent: experimental/iox
identifier: experimental/iox/sql
weight: 201
flux/v0.x/tags: [inputs]
introduced: 0.186.0
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/iox/iox.flux#L33-L33
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`iox.sql()` executes an SQL query against a bucket in an IOx storage node.

This function creates a source that reads data from IOx.

##### Function type signature

```js
(bucket: string, query: string) => stream[A] where A: Record
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### bucket
({{< req >}})
IOx bucket to read data from.



### query
({{< req >}})
Query to execute.



Loading

0 comments on commit 7482b32

Please sign in to comment.