Closed dferber90 closed 4 years ago
Thank you for posting this issue. Arrays are not supported. And yes, I plan to add them. You can now only simplify the way of how hostnamesList
is created:
import {
flux,
fluxDuration,
toFluxValue,
fluxExpression,
} from '@influxdata/influxdb-client'
const hostnames = ['a', 'b', 'c']
const hostnamesList = fluxExpression(hostnames.map(toFluxValue).join(','))
Arrays will be supported in the next release, you can also use a nightly build (see https://www.npmjs.com/package/@influxdata/influxdb-client) once #219 is merged
Thank you for the fast response and impressively fast addition ☺️
Proposal:
A way to sanitize an array of strings so that they can be used in Flux queries.
Current behavior:
Not implemented, or not discovered by me.
Desired behavior:
A way to sanitize strings in an array so I can use that array in
contains(set: sanitizedArray, value: foo)
. Other sanitizations regarding arrays might be missing as well.Use case:
I have a dynamically generated list of hostnames, for which I'd like to find all matches. To achieve that, I'm trying to use
contains
to match one of the hostnames.This is more or less what I got, but the code is not working
Alternatives considered:
Chaining the queries together using "or" expressions
Manually creating the list
Could you show me the right way to achieve this, or is this a missing feature?