web

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 Plotter,
	logger *slog.Logger,
) http.Handler

func ReportHandler added in v0.11.1

func ReportHandler(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) Get added in v0.12.0

func (c *ImageCache) Get(ctx context.Context, plotType string, args arguments) (string, []byte, error)

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 Plotter added in v0.11.1

type Plotter interface {
	Plot(repository.Measurements, bool) (*vgimg.PngCanvas, 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 interface{}, expiration time.Duration) *redis.StatusCmd
}

type Repository added in v0.11.1

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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