db

package
v0.0.0-...-33e8507 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entities

type Entities struct {
	Zones            []models.Zone
	Valves           []models.Valve
	Thermostats      []models.Thermostat
	ZoneToThermostat map[int][]*models.Thermostat
	ZoneToValve      map[int][]*models.Valve
	IDToZone         map[int]*models.ZoneModel
}

LoadConfig loads the configuration from the database This would usually be just the connection in this file but to keep things simple for now I do not want business logic in here permanently

func LoadEntities

func LoadEntities(path string) Entities

type InfluxDBClient

type InfluxDBClient struct {
	WriteAPI influxAPI.WriteAPI
	QueryAPI influxAPI.QueryAPI
	// contains filtered or unexported fields
}

func CreateInfluxClient

func CreateInfluxClient(url, port, token, org, bucket string) *InfluxDBClient

func (*InfluxDBClient) Close

func (c *InfluxDBClient) Close()

func (*InfluxDBClient) FetchZoneTemp

func (c *InfluxDBClient) FetchZoneTemp(zoneID int, ctx context.Context) (float64, error)

func (*InfluxDBClient) WriteTarget

func (c *InfluxDBClient) WriteTarget(zoneID int, target float64)

func (*InfluxDBClient) WriteTemperature

func (c *InfluxDBClient) WriteTemperature(zoneID int, thermostatID string, temp float64)

func (*InfluxDBClient) WriteTemperatureData

func (c *InfluxDBClient) WriteTemperatureData(zoneID int, target, error, output float64)

func (*InfluxDBClient) WriteValveState

func (c *InfluxDBClient) WriteValveState(zoneID int, valveID int, state int)

type TimeSeriesDataStore

type TimeSeriesDataStore interface {
	Close()
	WriteTemperature(zoneID int, thermostatID string, temp float64)
	WriteTemperatureData(zoneID int, target, error, output float64)
	WriteTarget(zoneID int, target float64)
	WriteValveState(zoneID int, valveID int, state int)
	FetchZoneTemp(zoneID int, ctx context.Context) (float64, error)
}

Jump to

Keyboard shortcuts

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