aggendpoint

package
v0.0.0-...-268bfc8 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 13 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(svc aggservice.Service) endpoint.Endpoint

func MakeCalculateEndpoint

func MakeCalculateEndpoint(svc aggservice.Service) endpoint.Endpoint

Types

type AggregateRequest

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

type AggregateResponse

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

type CalculateRequest

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

type CalculateResponse

type CalculateResponse struct {
	OBUID         int     `json:"obuID"`
	TotalDistance float64 `json:"totalDistance"`
	TotalAmount   float64 `json:"totalAmount"`
	Err           error   `json:"err,omitempty"`
}

type Set

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

func New

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

func (Set) Aggregate

func (s Set) Aggregate(ctx context.Context, distance 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