mathendpoint

package
v0.0.0-...-14493fd Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 7 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

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

func (s Set) Divide(ctx context.Context, a, b float64) (float64, error)

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

func (s Set) Max(ctx context.Context, a, b float64) (float64, error)

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

func (s Set) Min(ctx context.Context, a, b float64) (float64, error)

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

func (s Set) Multiply(ctx context.Context, a, b float64) (float64, error)

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

func (s Set) Pow(ctx context.Context, a, b float64) (float64, error)

Pow 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) Subtract

func (s Set) Subtract(ctx context.Context, a, b float64) (float64, error)

Subtract 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) Sum

func (s Set) Sum(ctx context.Context, a, b float64) (float64, error)

Sum implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.

Jump to

Keyboard shortcuts

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