「INFLUXDB」- Flux

Flux 是一种函数式脚本语言,可让我们查询和处理来自 InfluxDB 的数据;

快速入门

InfluxDB OSS 2.6 Documentation/Query data/Query data with Flux

from(bucket: "get-started")
    |> range(start: 2022-01-01T08:00:00Z, stop: 2022-01-01T20:00:01Z)
    |> filter(fn: (r) => r._measurement == "home")
    |> filter(fn: (r) => r._field== "co" or r._field == "hum" or r._field == "temp")

from(), range(), filter():函数
|>:管道符号

进阶学习

Get started with Flux | Flux 0.x Documentation

浏览结构

Explore your data schema with Flux | InfluxDB Cloud Documentation

List fields in a measurement

import "influxdata/influxdb/schema"

schema.measurementFieldKeys(
    bucket: "example-bucket",
    measurement: "example-measurement",
)