aggendpoint

package
v0.0.0-...-41d5476 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentingMiddleware

func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) endpoint.Middleware

func MakeAggregateEndpoint

func MakeAggregateEndpoint(s aggservice.Service) endpoint.Endpoint

func MakeCalculateEndpoint

func MakeCalculateEndpoint(s aggservice.Service) endpoint.Endpoint

Types

type AggregateRequest

type AggregateRequest struct {
	OBUID int     `json:"obuID"`
	Value float64 `json:"value"`
	Unix  int64   `jsin:"unix"`
}

type AggregateResponse

type AggregateResponse struct {
	Err error `json:"err"`
}

type CalculateRequest

type CalculateRequest struct {
	OBUID int `json:"obuID"`
}

type CalculateResponse

type CalculateResponse struct {
	OBUID         int     `json:"obuID"`
	TotalDistance float64 `json:"totalDistance"`
	Amount        float64 `json:"amount"`
	Err           error   `json:"err"`
}

type Set

type Set struct {
	AggregateEndpoint endpoint.Endpoint
	CalculateEndpoint endpoint.Endpoint
}

func New

func New(svc aggservice.Service, duration metrics.Histogram, logger log.Logger) Set

func (Set) Aggregate

func (s Set) Aggregate(ctx context.Context, dist types.Distance) error

func (Set) Calculate

func (s Set) Calculate(ctx context.Context, id int) (*types.Invoice, error)

Jump to

Keyboard shortcuts

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