web

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 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

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

func PlotHandler

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

func PlotterHandler

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

func ReportHandler

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

Types

type ImageCache

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

func (*ImageCache) Middleware

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

func (*ImageCache) Set

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

type RedisClient

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

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