influxdb

Package influxdb lets you write data to an InfluxDB v2 server.

Index

Functions

func NewClient

1func NewClient(serverURL string, authToken string) *Client

NewClient creates Client for connecting to given serverURL with provided authentication token, with the default options. serverURL is the InfluxDB server base URL, e.g. http://localhost:8086, authToken is an authentication token.

func NewClientWithOptions

1func NewClientWithOptions(serverURL string, authToken string, options Options) *Client

NewClientWithOptions creates Client for connecting to given serverURL with provided authentication token and configured with custom Options. serverURL is the InfluxDB server base URL, e.g. http://localhost:8086, authToken is an authentication token.

func NewPointWithMeasurement

1func NewPointWithMeasurement(measurement string) *Point

NewPointWithMeasurement returns an empty point for the measurement with the time set to now. Use AddField and AddTag to add fields and tags to the point.

Types

type Bucket

1type Bucket struct {
2}

Bucket represents a bucket on the server and allows writing points to it.

func Write

1func (b *Bucket) Write(p ...*Point) error

WritePoint write one or more points into the bucket.

type Client

1type Client struct {
2}

Client provides API to communicate with an InfluxDB server.

func Bucket

1func (c *Client) Bucket(org, bucket string) *Bucket

Bucket returns a bucket.

func Ping

1func (c *Client) Ping() (bool, error)

Ping validates wether the server is running.

type Options

1type Options struct {
2	Tags	map[string]string	// A list of default tags
3	TLS	*tls.Config
4	GZip	bool
5}

Options holds configuration properties for communicating with InfluxDB server

type Point

1type Point struct {
2}

Point is represents InfluxDB time series point, holding tags and fields.

func AddField

1func (p *Point) AddField(key string, value any)

AddField adds a field to a point.

func AddTag

1func (p *Point) AddTag(key, value string)

AddTag adds a tag to a point.


© Matthias Hochgatterer – MastodonGithubRésumé