influxdb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MeasurementSleepAnalysisDetailed   = "sleep_analysis_detailed"
	MeasurementSleepAnalysisAggregated = "sleep_analysis_aggregated"
	MeasurementSleepPhases             = "sleep_phases"
)

Variables

This section is empty.

Functions

func CreateWorkoutStatistics

func CreateWorkoutStatistics(workout *healthautoexport.Workout) healthautoexport.WorkoutFields

CreateWorkoutStatistics returns additional fields for a Workout.

func GetUnitizedMeasurementName

func GetUnitizedMeasurementName(name string, metric WithUnits) string

GetUnitizedMeasurementName returns the measurement name. It will add a suffix for the unit to the measurement name.

func NewBackend

func NewBackend(client Client) (backends.Backend, error)

func NewInfluxDBClient

func NewInfluxDBClient() (influxdb2.Client, error)

Types

type Backend

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

Backend InfluxDB is used to store ingested metrics into InfluxDB. All metrics will be stored as single Points (i.e. time-series data).

func (*Backend) Name

func (b *Backend) Name() string

func (*Backend) Write

func (b *Backend) Write(payload *healthautoexport.Payload, targetName string) error

type Client added in v0.1.1

type Client interface {
	WriteMetrics(ctx context.Context, point ...*write.Point) error
	WriteWorkouts(ctx context.Context, point ...*write.Point) error
}

Client knows how to write to an InfluxDB database.

func NewClient added in v0.1.1

func NewClient() (Client, error)

NewClient returns a real influxdb Client initialized from flags.

type MockClient added in v0.1.1

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

MockClient is a mock implementation of Client.

func NewMockClient added in v0.1.1

func NewMockClient() *MockClient

func (*MockClient) ReadMetrics added in v0.1.1

func (m *MockClient) ReadMetrics() []*write.Point

func (*MockClient) ReadWorkouts added in v0.1.1

func (m *MockClient) ReadWorkouts() []*write.Point

func (*MockClient) Reset added in v0.1.1

func (m *MockClient) Reset()

func (*MockClient) WriteMetrics added in v0.1.1

func (m *MockClient) WriteMetrics(_ context.Context, point ...*write.Point) error

func (*MockClient) WriteWorkouts added in v0.1.1

func (m *MockClient) WriteWorkouts(_ context.Context, point ...*write.Point) error

type WithUnits

type WithUnits interface {
	GetUnits() healthautoexport.Units
}

Jump to

Keyboard shortcuts

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