scraper

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Scraper
	Interval time.Duration
	// contains filtered or unexported fields
}

Client collects measurements and returns a summary of those collected measurement

func (*Client) Count

func (c *Client) Count() int

Count returns the number of measurements currently collected

func (*Client) Run

func (c *Client) Run(ctx context.Context)

Run collects measurements at the specified interval and records them for latest summarizing

func (*Client) Summarize

func (c *Client) Summarize() Sample

Summarize returns a summary of collected measurements. The summary is then reset, i.e. previously collected measurements are discarded.

type Sample

type Sample struct {
	Timestamp time.Time
	Value     float64
}

type Scraper

type Scraper interface {
	Scrape(ctx context.Context) (Sample, error)
}

type SolarEdgeScraper

type SolarEdgeScraper struct {
	solaredge.API
	SiteID int
}

func (*SolarEdgeScraper) Scrape

func (s *SolarEdgeScraper) Scrape(ctx context.Context) (sample Sample, err error)

type Summarizer

type Summarizer interface {
	Summarize() Sample
	Count() int
	Run(ctx context.Context)
}

A Summarizer returns the summary of a list of samples

type Summary

type Summary struct {
	Total float64
	Count int
	First time.Time
	Last  time.Time
}

func (*Summary) Add

func (summary *Summary) Add(m Sample)

func (*Summary) Summarize

func (summary *Summary) Summarize() (result Sample)

type TadoScraper

type TadoScraper struct {
	tado.API
}

func (*TadoScraper) Scrape

func (t *TadoScraper) Scrape(ctx context.Context) (sample Sample, err error)

Jump to

Keyboard shortcuts

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