Documentation ¶
Index ¶
- func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func MakeDivideEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakeMaxEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakeMinEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakeMultiplyEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakePowEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakeSubtractEndpoint(s mathservice2.Service) endpoint.Endpoint
- func MakeSumEndpoint(s mathservice2.Service) endpoint.Endpoint
- type MathOpRequest
- type MathOpResponse
- type Set
- func (s Set) Divide(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Max(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Min(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Multiply(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Pow(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Subtract(ctx context.Context, a, b float64) (float64, error)
- func (s Set) Sum(ctx context.Context, a, b float64) (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentingMiddleware ¶
func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
InstrumentingMiddleware adds prometheus metrics for each endpoint invocation
func MakeDivideEndpoint ¶
func MakeDivideEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeDivideEndpoint constructs a Divide endpoint wrapping the service.
func MakeMaxEndpoint ¶
func MakeMaxEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeMaxEndpoint constructs a Max endpoint wrapping the service.
func MakeMinEndpoint ¶
func MakeMinEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeMinEndpoint constructs a Min endpoint wrapping the service.
func MakeMultiplyEndpoint ¶
func MakeMultiplyEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeMultiplyEndpoint constructs a Multiply endpoint wrapping the service.
func MakePowEndpoint ¶
func MakePowEndpoint(s mathservice2.Service) endpoint.Endpoint
MakePowEndpoint constructs a Pow endpoint wrapping the service.
func MakeSubtractEndpoint ¶
func MakeSubtractEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeSubtractEndpoint constructs a Subtract endpoint wrapping the service.
func MakeSumEndpoint ¶
func MakeSumEndpoint(s mathservice2.Service) endpoint.Endpoint
MakeSumEndpoint constructs a Sum endpoint wrapping the service.
Types ¶
type MathOpRequest ¶
type MathOpRequest struct {
A, B float64
}
MathOpRequest collects the request parameters for the math methods.
type MathOpResponse ¶
type MathOpResponse struct { V float64 `json:"v"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
MathOpResponse collects the response values for the math methods.
func (MathOpResponse) Failed ¶
func (r MathOpResponse) Failed() error
Failed implements endpoint.Failer.
type Set ¶
type Set struct { DivideEndpoint endpoint.Endpoint MaxEndpoint endpoint.Endpoint MinEndpoint endpoint.Endpoint MultiplyEndpoint endpoint.Endpoint PowEndpoint endpoint.Endpoint SubtractEndpoint endpoint.Endpoint SumEndpoint endpoint.Endpoint }
Set collects all of the endpoints that compose an add service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
func New ¶
func New(svc mathservice2.Service, logger log.Logger) Set
New returns a Set that wraps the provided server, and wires in all of the expected endpoint middlewares via the various parameters.
func (Set) Divide ¶
Divide implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.
func (Set) Max ¶
Max implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.
func (Set) Min ¶
Min implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.
func (Set) Multiply ¶
Multiply implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.
func (Set) Pow ¶
Pow implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.