history

package
v0.0.0-...-417c523 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HistoryDB = "history"

	LedsTable    = "leds"
	BlindsTable  = "blinds"
	SwitchsTable = "switchs"
	HvacsTable   = "hvacs"
	TdTable      = "tds"
)

Variables

This section is empty.

Functions

func NewError

func NewError(text string) error

NewError raise an error

func SaveBlindHistory

func SaveBlindHistory(db HistoryDb, driver dblind.Blind) error

func SaveHistory

func SaveHistory(db HistoryDb, dbName, tbName string, obj interface{}) error

func SaveHvacHistory

func SaveHvacHistory(db HistoryDb, driver dhvac.Hvac) error

func SaveLedHistory

func SaveLedHistory(db HistoryDb, driver dl.Led) error

Types

type BlindHistory

type BlindHistory struct {
	Mac    string  `json:"mac"`
	Energy float64 `json:"energy"`
	Power  int     `json:"power"`
	Date   string  `json:"date"`
	Group  int     `json:"group"`
}

func GetBlindsHistory

func GetBlindsHistory(db HistoryDb) []BlindHistory

func ToBlindHistory

func ToBlindHistory(val interface{}) (*BlindHistory, error)

ToBlindHistory convert map interface to blind object

type HistoryDb

type HistoryDb = database.DatabaseInterface

func ConnectDatabase

func ConnectDatabase(ip, port string) (*HistoryDb, error)

ConnectDatabase plug datbase

type HvacHistory

type HvacHistory struct {
	Mac   string `json:"mac"`
	Power int    `json:"power"`
	Date  string `json:"date"`
	Group int    `json:"group"`
}

func GetHvacsHistory

func GetHvacsHistory(db HistoryDb) []HvacHistory

func ToHvacHistory

func ToHvacHistory(val interface{}) (*HvacHistory, error)

ToHvacHistory convert map interface to Hvac object

type LedHistory

type LedHistory struct {
	Mac    string  `json:"mac"`
	Energy float64 `json:"energy"`
	Power  int     `json:"power"`
	Date   string  `json:"date"`
	Group  int     `json:"group"`
}

func GetLedsHistory

func GetLedsHistory(db HistoryDb) []LedHistory

func ToLedHistory

func ToLedHistory(val interface{}) (*LedHistory, error)

ToLedHistory convert map interface to Led object

type SwitchHistory

type SwitchHistory struct {
	Mac     string  `json:"mac"`
	Energy  float64 `json:"energy"`
	Power   int     `json:"power"`
	Date    string  `json:"date"`
	Cluster int     `json:"cluster"`
}

Jump to

Keyboard shortcuts

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