influxdb

package
v0.0.0-...-bd5401e Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package influxdb contains the domain concept definitions needed to support Magistrala InfluxDB database functionality.

It provides the abstraction of the InfluxDB database service, which is used to configure, setup and connect to the InfluxDB database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, config Config) (influxdb2.Client, error)

Connect create InfluxDB client and connect to InfluxDB server.

func Setup

func Setup(ctx context.Context, envPrefix string) (influxdb2.Client, error)

Setup load configuration from environment variable, create InfluxDB client and connect to InfluxDB server.

Types

type Config

type Config struct {
	Protocol           string        `env:"PROTOCOL"              envDefault:"http"`
	Host               string        `env:"HOST"                  envDefault:"localhost"`
	Port               string        `env:"PORT"                  envDefault:"8086"`
	Username           string        `env:"ADMIN_USER"            envDefault:"magistrala"`
	Password           string        `env:"ADMIN_PASSWORD"        envDefault:"magistrala"`
	DBName             string        `env:"NAME"                  envDefault:"magistrala"`
	Bucket             string        `env:"BUCKET"                envDefault:"magistrala-bucket"`
	Org                string        `env:"ORG"                   envDefault:"magistrala"`
	Token              string        `env:"TOKEN"                 envDefault:"magistrala-token"`
	DBUrl              string        `env:"DBURL"                 envDefault:""`
	UserAgent          string        `env:"USER_AGENT"            envDefault:"InfluxDBClient"`
	Timeout            time.Duration `env:"TIMEOUT"` // Influxdb client configuration by default has no timeout duration , this field will not have a fallback default timeout duration. Reference: https://pkg.go.dev/github.com/influxdata/influxdb@v1.10.0/client/v2#HTTPConfig
	InsecureSkipVerify bool          `env:"INSECURE_SKIP_VERIFY"  envDefault:"false"`
}

Jump to

Keyboard shortcuts

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