package addendpoint
import "github.com/go-kit/kit/examples/addsvc/pkg/addendpoint"
Index ¶
- func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeConcatEndpoint(s addservice.Service) endpoint.Endpoint
- func MakeSumEndpoint(s addservice.Service) endpoint.Endpoint
- type ConcatRequest
- type ConcatResponse
- type Set
- func New(svc addservice.Service, logger log.Logger, duration metrics.Histogram, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer) Set
- func (s Set) Concat(ctx context.Context, a, b string) (string, error)
- func (s Set) Sum(ctx context.Context, a, b int) (int, error)
- type SumRequest
- type SumResponse
Functions ¶
func InstrumentingMiddleware ¶
func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
InstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.
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 MakeConcatEndpoint ¶
func MakeConcatEndpoint(s addservice.Service) endpoint.Endpoint
MakeConcatEndpoint constructs a Concat endpoint wrapping the service.
func MakeSumEndpoint ¶
func MakeSumEndpoint(s addservice.Service) endpoint.Endpoint
MakeSumEndpoint constructs a Sum endpoint wrapping the service.
Types ¶
type ConcatRequest ¶
type ConcatRequest struct { A, B string }
ConcatRequest collects the request parameters for the Concat method.
type ConcatResponse ¶
ConcatResponse collects the response values for the Concat method.
func (ConcatResponse) Failed ¶
func (r ConcatResponse) Failed() error
Failed implements endpoint.Failer.
type Set ¶
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 addservice.Service, logger log.Logger, duration metrics.Histogram, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer) 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) Concat ¶
Concat 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 ¶
Sum implements the service interface, so Set may be used as a service. This is primarily useful in the context of a client library.
type SumRequest ¶
type SumRequest struct { A, B int }
SumRequest collects the request parameters for the Sum method.
type SumResponse ¶
type SumResponse struct { V int `json:"v"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
SumResponse collects the response values for the Sum method.
func (SumResponse) Failed ¶
func (r SumResponse) Failed() error
Failed implements endpoint.Failer.
Source Files ¶
- Version
- v0.8.0
- Published
- Nov 8, 2018
- Platform
- js/wasm
- Imports
- 15 packages
- Last checked
- 4 days ago –
Tools for package owners.