db

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 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 points to

func NewInflux

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

NewInflux creates an influx helper client

func (*Influx) WritePoints added in v0.0.23

func (i *Influx) WritePoints(points []InfluxPoint) error

WritePoints 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 point
	ID string `influx:"id,tag"`

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

	// Average OR
	// Instantaneous analog or digital value of the point.
	// 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 point was taken
	Time time.Time `influx:"time"`

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

InfluxPoint represents a point that is written into influxdb

func PointToInfluxPoint added in v0.0.12

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

PointToInfluxPoint converts a point to influx point

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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