aggendpoint

package
v0.0.0-...-336f265 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 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

LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.

func MakeAggregateEndpoint

func MakeAggregateEndpoint(s aggservice.Service) endpoint.Endpoint

func MakeConcatEndpoint

func MakeConcatEndpoint(s aggservice.Service) endpoint.Endpoint

MakeConcatEndpoint constructs a Concat endpoint wrapping the service.

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"`
}

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"`
}

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, dist types.Distance) error

func (Set) Calculate

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

Jump to

Keyboard shortcuts

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