invdb

package
v0.0.0-...-7f8764f Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevicesLocal

type DevicesLocal struct {
	ID          int64
	DateCreated string
	Bat2Grid_P  sql.NullString // string
	Dc_P        sql.NullString // string
	DigitalIn   sql.NullString // string
	EM_State    sql.NullString // string
	Grid2Bat_P  sql.NullString // string
	Grid_L1_I   sql.NullString // string
	Grid_L1_P   sql.NullString // string
	Grid_L2_I   sql.NullString // string
	Grid_L2_P   sql.NullString // string
	Grid_L3_I   sql.NullString // string
	Grid_L3_P   sql.NullString // string
	Grid_P      sql.NullString // string
	Grid_Q      sql.NullString // string
	Grid_S      sql.NullString // string
	HomeBat_P   sql.NullString //string
	HomeGrid_P  sql.NullString //string
	HomeOwn_P   sql.NullString //string
	HomePv_P    sql.NullString //string
	Home_P      sql.NullString //string
	Iso_R       sql.NullString // string
	LimitEvuRel sql.NullString // string
	PV2Bat_P    sql.NullString // string
}

type DevicesLocalAc

type DevicesLocalAc struct {
	ID            int64
	DateCreated   string
	CosPhi        sql.NullString // string
	Frequency     sql.NullString // string
	InvIn_P       sql.NullString // string
	InvOut_P      sql.NullString // string
	L1_I          sql.NullString // string
	L1_P          sql.NullString // string
	L1_U          sql.NullString // string
	L2_I          sql.NullString // string
	L2_P          sql.NullString // string
	L2_U          sql.NullString // string
	L3_I          sql.NullString // string
	L3_P          sql.NullString // string
	L3_U          sql.NullString // string
	P             sql.NullString // string
	Q             sql.NullString // string
	ResidualCDc_I sql.NullString // string
	S             sql.NullString // string
}

type DevicesLocalBattery

type DevicesLocalBattery struct {
	ID              int64
	DateCreated     string
	FullChargeCap_E sql.NullString // string
	I               sql.NullString // string
	P               sql.NullString // string
	SoC             sql.NullString // string
	U               sql.NullString // string
	WorkCapacity    sql.NullString // string
}

type DevicesLocalBatteryLast

type DevicesLocalBatteryLast struct {
	ID              int64
	DateCreated     string
	BatManufacturer sql.NullString // string
	BatModel        sql.NullString // string
	BatSerialNo     sql.NullString // string
	BatVersionFW    sql.NullString // string
	Cycles          sql.NullString // string
}

type DevicesLocalLast

type DevicesLocalLast struct {
	ID            int64
	DateCreated   string
	InverterState sql.NullString // string
	SinkMax_P     sql.NullString // string
	SourceMax_P   sql.NullString // string
	WorkTime      sql.NullString // string
}

type DevicesLocalPowermeter

type DevicesLocalPowermeter struct {
	ID          int64
	DateCreated string
	CosPhi      sql.NullString // string
	Frequency   sql.NullString // string
	P           sql.NullString // string
	Q           sql.NullString // string
	S           sql.NullString // string
}

type DevicesLocalPv

type DevicesLocalPv struct {
	ID          int64
	DateCreated string
	I           sql.NullString // string
	P           sql.NullString // string
	U           sql.NullString // string
}

type ProcessdataEntry

type ProcessdataEntry struct {
	ID          int64
	DateCreated string
	ProcessData string
}

type Repository

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

func NewRepository

func NewRepository(db *sql.DB) *Repository

NewRepository creates a new database representation

func (*Repository) AddData

func (r *Repository) AddData(payload string) (int64, error)

AddData adds dataset with JSON payload to solardata table

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) ConvertToString

func (r *Repository) ConvertToString(payload *reflect.Value) string

ConvertToString converts a value created by reflect to string. It returns an empty string in case of error. So it's possible to use sql.NullString and string type in processdata type definition.

func (*Repository) GetDevicesLocal

func (r *Repository) GetDevicesLocal() (DevicesLocal, error)

GetDevicesLocal loads the values from devices:local section as average of the last 5 minutes

func (*Repository) GetDevicesLocalAc

func (r *Repository) GetDevicesLocalAc() (DevicesLocalAc, error)

GetDevicesLocalAc loads the values from devices:local:ac section as average of the last 5 minutes

func (*Repository) GetDevicesLocalBattery

func (r *Repository) GetDevicesLocalBattery() (DevicesLocalBattery, error)

GetDevicesLocalBattery loads the values from devices:local:battery section as average of the last 30 seconds

func (*Repository) GetDevicesLocalBatteryLast

func (r *Repository) GetDevicesLocalBatteryLast() (DevicesLocalBatteryLast, error)

GetDevicesLocalBatteryLast loads the values from devices:local:battery section which are specified as last values

func (*Repository) GetDevicesLocalLast

func (r *Repository) GetDevicesLocalLast() (DevicesLocalLast, error)

GetDevicesLocalLast loads the values from devices:local section which are specified as last values

func (*Repository) GetDevicesLocalPowermeter

func (r *Repository) GetDevicesLocalPowermeter() (DevicesLocalPowermeter, error)

GetDevicesLocalPowermeter loads the values from devices:local:powermeter section as average of the last 5 minutes

func (*Repository) GetDevicesLocalPv1

func (r *Repository) GetDevicesLocalPv1() (DevicesLocalPv, error)

GetDevicesLocalPv1 loads the values from devices:local:pv1 section as average of the last 5 minutes

func (*Repository) GetDevicesLocalPv2

func (r *Repository) GetDevicesLocalPv2() (DevicesLocalPv, error)

GetDevicesLocalPv2 loads the values from devices:local:pv2 section as average of the last 5 minutes

func (*Repository) GetStatisticEnergyFlowLast

func (r *Repository) GetStatisticEnergyFlowLast() (StatisticEnergyFlowLast, error)

GetStatisticEnergyFlowLast loads the last values from all scb:Statistics:EnergyFlow sections

func (*Repository) RemoveData

func (r *Repository) RemoveData(olderThanDays int) (int64, error)

RemoveData deletes entries from solardata table which are older than "olderThanDays" days.

type StatisticEnergyFlowLast

type StatisticEnergyFlowLast struct {
	ID                                int64
	DateCreated                       string
	StatisticAutarkyDay               sql.NullString // string
	StatisticAutarkyMonth             sql.NullString // string
	StatisticAutarkyTotal             sql.NullString // string
	StatisticAutarkyYear              sql.NullString // string
	StatisticCO2SavingDay             sql.NullString // string
	StatisticCO2SavingMonth           sql.NullString // string
	StatisticCO2SavingTotal           sql.NullString // string
	StatisticCO2SavingYear            sql.NullString // string
	StatisticEnergyChargeGridDay      sql.NullString // string
	StatisticEnergyChargeGridMonth    sql.NullString // string
	StatisticEnergyChargeGridTotal    sql.NullString // string
	StatisticEnergyChargeGridYear     sql.NullString // string
	StatisticEnergyChargeInvInDay     sql.NullString // string
	StatisticEnergyChargeInvInMonth   sql.NullString // string
	StatisticEnergyChargeInvInTotal   sql.NullString // string
	StatisticEnergyChargeInvInYear    sql.NullString // string
	StatisticEnergyChargePvDay        sql.NullString // string
	StatisticEnergyChargePvMonth      sql.NullString // string
	StatisticEnergyChargePvTotal      sql.NullString // string
	StatisticEnergyChargePvYear       sql.NullString // string
	StatisticEnergyDischargeDay       sql.NullString // string
	StatisticEnergyDischargeMonth     sql.NullString // string
	StatisticEnergyDischargeTotal     sql.NullString // string
	StatisticEnergyDischargeYear      sql.NullString // string
	StatisticEnergyDischargeGridDay   sql.NullString // string
	StatisticEnergyDischargeGridMonth sql.NullString // string
	StatisticEnergyDischargeGridTotal sql.NullString // string
	StatisticEnergyDischargeGridYear  sql.NullString // string
	StatisticEnergyHomeDay            sql.NullString // string
	StatisticEnergyHomeMonth          sql.NullString // string
	StatisticEnergyHomeTotal          sql.NullString // string
	StatisticEnergyHomeYear           sql.NullString // string
	StatisticEnergyHomeBatDay         sql.NullString // string
	StatisticEnergyHomeBatMonth       sql.NullString // string
	StatisticEnergyHomeBatTotal       sql.NullString // string
	StatisticEnergyHomeBatYear        sql.NullString // string
	StatisticEnergyHomeGridDay        sql.NullString // string
	StatisticEnergyHomeGridMonth      sql.NullString // string
	StatisticEnergyHomeGridTotal      sql.NullString // string
	StatisticEnergyHomeGridYear       sql.NullString // string
	StatisticEnergyHomeOwnTotal       sql.NullString // string
	StatisticEnergyHomePvDay          sql.NullString // string
	StatisticEnergyHomePvMonth        sql.NullString // string
	StatisticEnergyHomePvTotal        sql.NullString // string
	StatisticEnergyHomePvYear         sql.NullString // string
	StatisticEnergyPv1Day             sql.NullString // string
	StatisticEnergyPv1Month           sql.NullString // string
	StatisticEnergyPv1Total           sql.NullString // string
	StatisticEnergyPv1Year            sql.NullString // string
	StatisticEnergyPv2Day             sql.NullString // string
	StatisticEnergyPv2Month           sql.NullString // string
	StatisticEnergyPv2Total           sql.NullString // string
	StatisticEnergyPv2Year            sql.NullString // string
	StatisticEnergyPv3Day             sql.NullString // string
	StatisticEnergyPv3Month           sql.NullString // string
	StatisticEnergyPv3Total           sql.NullString // string
	StatisticEnergyPv3Year            sql.NullString // string
	StatisticOwnConsumptionRateDay    sql.NullString // string
	StatisticOwnConsumptionRateMonth  sql.NullString // string
	StatisticOwnConsumptionRateTotal  sql.NullString // string
	StatisticOwnConsumptionRateYear   sql.NullString // string
	StatisticYieldDay                 sql.NullString // string
	StatisticYieldMonth               sql.NullString // string
	StatisticYieldTotal               sql.NullString // string
	StatisticYieldYear                sql.NullString // string
}

Jump to

Keyboard shortcuts

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