Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Truncate time.Duration
Functions ¶
func SetTruncateValue ¶ added in v0.0.5
Types ¶
type Data ¶
Data is an array of timestamps and values representing the same source of data over a period of time
func (*Data) Float ¶
Return the float64 representation of the data. If the data is not represented by a float64 value a panic will follow
type DataManager ¶
type DataManager struct {
DataMap map[string]map[string]*Timeseries `json:"datamap"`
Subs []string
}
DataManager is a map of Timeseries data that belongs to a specific station. The timeseries for each station are differentiated by the timeseries labels.
func GetDataManager ¶
func GetDataManager() *DataManager
func NewDataManager ¶
func NewDataManager() (dm *DataManager)
NewDataManager creates a new DataManager typically called by NewStation()
func (*DataManager) Add ¶
func (dm *DataManager) Add(station, label string, data any)
Add will add data according to station and label
func (*DataManager) Callback ¶
func (dm *DataManager) Callback(msg *messanger.Msg)
Callback is the callback used by the DataManager to receive MQTT messangers. TODO: move this call back to the stations because the stations will have a better understanding of the data they are subscribing to.
func (*DataManager) Dump ¶
func (dm *DataManager) Dump(w io.Writer)
func (DataManager) ServeHTTP ¶
func (dm DataManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP provides a REST interface to the config structure
type Store ¶
type Timeseries ¶
type Timeseries struct {
Station string `json:"station"`
Label string `json:"label"`
Timestamp time.Duration `json:"start"`
Data []*Data `json:"data"`
}
Timeseries represents a single source of data over a time period
func NewTimeseries ¶
func NewTimeseries(station, label string) *Timeseries
NewTimeseries will start a new data timeseries with the given label
func (*Timeseries) Add ¶
func (ts *Timeseries) Add(d any) *Data
Add a new Data point to the given Timeseries
func (*Timeseries) Len ¶
func (ts *Timeseries) Len() int
Len returns the number of data points contained in this timeseries
func (*Timeseries) String ¶
func (ts *Timeseries) String() string