db

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Influx

type Influx struct {
	// contains filtered or unexported fields
}

Influx represents and influxdb that we can write samples to

func NewInflux

func NewInflux(url, dbName, user, password string) (*Influx, error)

NewInflux creates an influx helper client

func (*Influx) WriteSamples

func (i *Influx) WriteSamples(samples []InfluxPoint) error

WriteSamples to influxdb

type InfluxPoint added in v0.0.12

type InfluxPoint struct {
	// Type of point (voltage, current, key, etc)
	Type string `influx:"type,tag"`

	// ID of the sensor that provided the sample
	ID string `influx:"id,tag"`

	// DeviceID of the ID of the device that provided the sample
	DeviceID string `influx:"deviceId,tag"`

	// Average OR
	// Instantaneous analog or digital value of the sample.
	// 0 and 1 are used to represent digital values
	Value float64 `influx:"value"`

	// statistical values that may be calculated
	Min float64 `influx:"min"`
	Max float64 `influx:"max"`

	// Time the sample was taken
	Time time.Time `influx:"time"`

	// Duration over which the sample was taken
	Duration time.Duration `influx:"duration"`
}

InfluxPoint represents a sample that is written into influxdb

func PointToInfluxPoint added in v0.0.12

func PointToInfluxPoint(deviceID string, p data.Point) InfluxPoint

PointToInfluxPoint converts a sample to influx sample

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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