Documentation

Work with bytes types

A bytes type represents a sequence of byte values.

Type name: bytes

Bytes syntax

Flux does not provide a bytes literal syntax. Use the bytes() function to convert a string into bytes.

bytes(v: "hello")
// Returns [104 101 108 108 111]

Only string types can be converted to bytes.

Convert a column to bytes

  1. Use map() to iterate over and rewrite rows.
  2. Use bytes() to convert column values to bytes.
data
  |> map(fn: (r) => ({ r with _value: time(v: r._value) }))
Given the following input data:
_time _value (string)
2021-01-01T00:00:00Z foo
2021-01-01T02:00:00Z bar
2021-01-01T03:00:00Z baz
2021-01-01T04:00:00Z quz
The example above returns:
_time _value (bytes)
2021-01-01T00:00:00Z [102 111 111]
2021-01-01T02:00:00Z [98 97 114]
2021-01-01T03:00:00Z [98 97 122]
2021-01-01T04:00:00Z [113 117 122]

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.