web

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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultXYZConfig = plotters.XYZConfig{
	Title:   "Report",
	X:       "time",
	XTicker: "2006-01-02\n15:04:05",
	Y:       "solar intensity (%)",
	Width:   800,
	Height:  600,

	Ranges: []float64{0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000},

	ColorMap: moreland.SmoothBlueRed(),
}

Functions

func New added in v0.11.0

func New(repo Repository, imageCache *ImageCache, logger *slog.Logger) http.Handler

func PlotHandler added in v0.11.1

func PlotHandler(logger *slog.Logger) http.Handler

func PlotterHandler added in v0.11.1

func PlotterHandler(
	repository Repository,
	plotter string,
	logger *slog.Logger,
) http.Handler

func ReportHandler added in v0.11.1

func ReportHandler(repo Repository, logger *slog.Logger) http.Handler

Types

type ImageCache added in v0.12.0

type ImageCache struct {
	Namespace string
	Rounding  time.Duration
	TTL       time.Duration
	Client    RedisClient
}

func (*ImageCache) Middleware added in v0.12.0

func (c *ImageCache) Middleware(plotType string, logger *slog.Logger) func(next http.Handler) http.Handler

func (*ImageCache) Set added in v0.12.0

func (c *ImageCache) Set(ctx context.Context, key string, content []byte) error

type RedisClient added in v0.12.0

type RedisClient interface {
	Get(ctx context.Context, key string) *redis.StringCmd
	Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd
}

type Repository added in v0.11.1

type Repository interface {
	Get(from, to time.Time) (repository.Measurements, error)
	GetDataRange() (time.Time, time.Time, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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