From 1c398b937c4872803267c86dd0bdb7c8447458b2 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 5 Sep 2019 16:01:06 -0600 Subject: [PATCH 1/3] added flux 0.43 to the flux changelog --- content/v2.0/reference/release-notes/flux.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/content/v2.0/reference/release-notes/flux.md b/content/v2.0/reference/release-notes/flux.md index e3f0267b3..3352a8e00 100644 --- a/content/v2.0/reference/release-notes/flux.md +++ b/content/v2.0/reference/release-notes/flux.md @@ -11,13 +11,20 @@ aliases: --- {{% note %}} -_The latest release of InfluxDB v2.0 alpha includes **Flux v0.42.0**. +_The latest release of InfluxDB v2.0 alpha includes **Flux v0.43.0**. Though newer versions of Flux may be available, they will not be included with InfluxDB until the next InfluxDB v2.0 release._ {{% /note %}} --- +## v0.43.0 [2019-09-04] + +### Features +- PagerDuty endpoint for alerts and notifications. + +--- + ## v0.42.0 [2019-08-30] ### Features From 0a6aa30e59922228df999e7d73e92bc3efffb91b Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 7 Sep 2019 10:29:43 -0600 Subject: [PATCH 2/3] added string interpolation doc to flux reference --- assets/styles/themes/_theme-dark.scss | 2 +- assets/styles/tools/_color-palette.scss | 1 + .../flux/language/lexical-elements.md | 4 +- .../flux/language/string-interpolation.md | 96 +++++++++++++++++++ 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 content/v2.0/reference/flux/language/string-interpolation.md diff --git a/assets/styles/themes/_theme-dark.scss b/assets/styles/themes/_theme-dark.scss index 26efd67cc..4ca1c16ad 100644 --- a/assets/styles/themes/_theme-dark.scss +++ b/assets/styles/themes/_theme-dark.scss @@ -86,7 +86,7 @@ $article-note-table-row-alt: #3B2862; $article-note-table-scrollbar: $np-deepnight; $article-note-shadow: $np-deepnight; $article-note-code: $cp-comet; -$article-note-code-bg: $wp-telopea; +$article-note-code-bg: $wp-jaguar; $article-note-code-accent1: #567375; $article-note-code-accent2: $b-pool; $article-note-code-accent3: $gr-viridian; diff --git a/assets/styles/tools/_color-palette.scss b/assets/styles/tools/_color-palette.scss index 7004a1aa2..146282cfa 100644 --- a/assets/styles/tools/_color-palette.scss +++ b/assets/styles/tools/_color-palette.scss @@ -24,6 +24,7 @@ $g19-ghost: #FAFAFC; $g20-white: #FFFFFF; // Brand color // Warm Purples - Magentas +$wp-jaguar: #1d0135; $wp-telopea: #23043E; $wp-violentdark: #2d0749; $wp-violet: #32094E; diff --git a/content/v2.0/reference/flux/language/lexical-elements.md b/content/v2.0/reference/flux/language/lexical-elements.md index d19fb807b..b27481165 100644 --- a/content/v2.0/reference/flux/language/lexical-elements.md +++ b/content/v2.0/reference/flux/language/lexical-elements.md @@ -300,9 +300,9 @@ To be added: TODO: With string interpolation `string_lit` is not longer a lexica ``` String literals are also interpolated for embedded expressions to be evaluated as strings. -Embedded expressions are enclosed in curly brackets (`{}`). +Embedded expressions are enclosed in a dollar sign and curly braces (`${}`). The expressions are evaluated in the scope containing the string literal. -The result of an expression is formatted as a string and replaces the string content between the brackets. +The result of an expression is formatted as a string and replaces the string content between the braces. All types are formatted as strings according to their literal representation. A function `printf` exists to allow more precise control over formatting of various types. To include the literal curly brackets within a string they must be escaped. diff --git a/content/v2.0/reference/flux/language/string-interpolation.md b/content/v2.0/reference/flux/language/string-interpolation.md new file mode 100644 index 000000000..ebe90a9c4 --- /dev/null +++ b/content/v2.0/reference/flux/language/string-interpolation.md @@ -0,0 +1,96 @@ +--- +title: String interpolation +description: > + Flux string interpolation evaluates string literals containing one or more placeholders + and returns a result with placeholders replaced with their corresponding values. +menu: + v2_0_ref: + parent: Flux specification + name: String interpolation +weight: 211 +--- + +Flux string interpolation evaluates string literals containing one or more placeholders +and returns a result with placeholders replaced with their corresponding values. + +## String interpolation syntax +To use Flux string interpolation, enclose embedded [expressions](/v2.0/reference/flux/language/expressions/) +in a dollar sign and curly braces `${}`. +Flux replaces the content between the braces with the result of the expression and +returns a string literal. + +```js +name = "John" + +"My name is ${name}." + +// My name is John. +``` + +{{% note %}} +#### Flux only interpolates string values +Flux currently interpolates only string values ([IMP#1775](https://github.com/influxdata/flux/issues/1775)). +Use the [string() function](/v2.0/reference/functions/built-in/transformations/type-conversions/string/) +to convert non-string values to strings. + +```js +count = 12 + +"I currently have ${string(v: count)} cats." +``` +{{% /note %}} + + +## Use dot notation to interpolate object values +[Objects](/v2.0/reference/flux/language/expressions/#object-literals) consist of key-value pairs. +Use [dot notation](/v2.0/reference/flux/language/expressions/#member-expressions) +to interpolate values from an object. + +```js +person = { + name: "John", + age: 42 +} + +"My name is ${person.name} and I'm ${string(v: person.age)} years old." + +// My name is John and I'm 42 years old. +``` + +Flux returns each record in query results as an object. +In Flux row functions, each row object is represented by `r`. +Use dot notation to interpolate specific column values from the `r` object. + +##### Use string interpolation to add a human-readable message +```js +from(bucket: "example-bucket") + |> range(start: -30m) + |> map(fn: (r) => ({ + r with + human-readable: "${r._field} is ${r._value} at ${string(v: r._time)}." + })) +``` + +## String interpolation versus concatenation +Flux supports both string interpolation and string concatenation. +String interpolation is a more concise method for achieving the same result. + +```js +person = { + name: "John", + age: 42 +} + +// String interpolation +"My name is ${person.name} and I'm ${string(v: person.age)} years old." + +// String concatenation +"My name is " + person.name + " and I'm " + string(v: person.age) + " years old." + +// Both return: My name is John and I'm 42 years old. +``` + +{{% note %}} +Check and notification message templates configured in the InfluxDB user interface +**do not** support string concatenation. +{{% /note %}} From b56d3db7980997ded23946ecef3ef78cb18de928 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 9 Sep 2019 11:22:37 -0600 Subject: [PATCH 3/3] Update string-interpolation.md --- content/v2.0/reference/flux/language/string-interpolation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/language/string-interpolation.md b/content/v2.0/reference/flux/language/string-interpolation.md index ebe90a9c4..463233ae4 100644 --- a/content/v2.0/reference/flux/language/string-interpolation.md +++ b/content/v2.0/reference/flux/language/string-interpolation.md @@ -30,7 +30,7 @@ name = "John" {{% note %}} #### Flux only interpolates string values Flux currently interpolates only string values ([IMP#1775](https://github.com/influxdata/flux/issues/1775)). -Use the [string() function](/v2.0/reference/functions/built-in/transformations/type-conversions/string/) +Use the [string() function](/v2.0/reference/flux/functions/built-in/transformations/type-conversions/string/) to convert non-string values to strings. ```js