influxdb2

package
v0.0.0-...-a550a8d Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: EUPL-1.2 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BooleanField    = "bool"
	DataField       = "data"
	StringField     = "string"
	SumField        = "sum"
	ValueField      = "value"
	UpdateTimeField = "update_time"
	HostTag         = "host"
	NameTag         = "name"
	UnitTag         = "unit"
	TimeField       = "time"
	TimeAttribute   = "_time"
)

InfluxDB tag and field values.

Variables

This section is empty.

Functions

func NewPoint

func NewPoint(name, host string, measurement senml.Measurement) *write.Point

NewPoint returns an InfluxDB point for a SenML measurement.

func NewSenML

func NewSenML(row *query.FluxRecord) (m senml.Measurement, err error)

NewSenML creates a new JSONPoint from an InfluxDB row

func PointsFromSenML

func PointsFromSenML(name, host string, list []senml.Measurement) (pts []*write.Point, err error)

PointsFromSenML creates a list of InfluxDB points from a list of SenML measurements.

Types

type Client

type Client struct {
	influxdb2.Client
	// contains filtered or unexported fields
}

Client is an extended InfluxDB client

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

NewClient returns a Client for the given configuration

func (*Client) Close

func (c *Client) Close() error

Close all connections to the InfluxDB server gracefully.

func (*Client) Query

func (c *Client) Query(name, host string, from, to time.Time, last bool) (measurements []senml.Measurement, err error)

Query builds a query based on the given parameters and returns the result as SenML.

func (*Client) Write

func (c *Client) Write(name, host string, data ...senml.Measurement) error

WriteSenML writes a series of SenML measurements to InfluxDB.

type ClientConfig

type ClientConfig struct {
	Host, Bucket, Org, Token string
}

ClientConfig contains InfluxDB client configuration

Jump to

Keyboard shortcuts

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