influx

package
v0.0.0-...-67aac8e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LineProtocol

func LineProtocol(name string, tags map[string]string, fields map[string]interface{}, t time.Time) (string, error)

LineProtocol format inputs to line protocol https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/

func Query

func Query(influxDBAddr, influxQl string, fns ...OptionsFn) (string, error)

Query execute influxQl (refer to https://docs.influxdata.com/influxdb/v1.7/query_language) influxDBAddr InfluxDB的连接地址, 例如http://localhost:8086, 注意:1. 右边没有/ 2. 右边不带其它path,例如/query等。 usage example: influx.Query(addr, ql, influx.WithBasic("username:password"))

func Write

func Write(influxDBWriteAddr, line string, fns ...OptionsFn) (*http.Response, string, error)

Write 写入打点值 refer https://github.com/DCSO/fluxline/blob/master/encoder.go usage example: influx.Write(addr, line, influx.WithBasic("username:password"))

Types

type Options

type Options struct {
	Basic string
}

type OptionsFn

type OptionsFn func(options *Options)

func WithBasic

func WithBasic(auth string) OptionsFn

WithBasic set basic auth, auth should be in format of username + ":" + password

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL