repository

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measurement

type Measurement struct {
	Timestamp time.Time
	Power     float64
	Intensity float64
	Weather   string
}

func (Measurement) LogValue added in v0.11.0

func (m Measurement) LogValue() slog.Value

type Measurements

type Measurements []Measurement

func (Measurements) Fold

func (m Measurements) Fold() Measurements

func (Measurements) Len added in v0.14.0

func (m Measurements) Len() int

func (Measurements) XY added in v0.14.0

func (m Measurements) XY(i int) (float64, float64)

func (Measurements) XYZ added in v0.14.0

func (m Measurements) XYZ(i int) (float64, float64, float64)

type PostgresDB

type PostgresDB struct {
	prometheus.Collector

	DBH *sqlx.DB
	// contains filtered or unexported fields
}

func NewPostgresDB

func NewPostgresDB(connectionString string) (*PostgresDB, error)

func (*PostgresDB) Get

func (db *PostgresDB) Get(from, to time.Time) (measurements Measurements, err error)

func (*PostgresDB) GetDataRange added in v0.14.0

func (db *PostgresDB) GetDataRange() (time.Time, time.Time, error)

func (*PostgresDB) GetWeather

func (db *PostgresDB) GetWeather(id int) (string, error)

func (*PostgresDB) GetWeatherID

func (db *PostgresDB) GetWeatherID(weather string) (int, error)

func (*PostgresDB) Store

func (db *PostgresDB) Store(measurement Measurement) error

Jump to

Keyboard shortcuts

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