addendpoint

package
v0.0.0-...-bfcc399 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 15 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 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.AddService) endpoint.Endpoint

func MakeSumEndpoint

func MakeSumEndpoint(s addservice.AddService) endpoint.Endpoint

Types

type ConcatRequest

type ConcatRequest struct {
	A, B string
}

type ConcatResponse

type ConcatResponse struct {
	V   string `json:"v"`
	Err error  `json:"-"`
}

func (ConcatResponse) Failed

func (r ConcatResponse) Failed() error

type Set

type Set struct {
	SumEndpoint    endpoint.Endpoint
	ConcatEndpoint endpoint.Endpoint
}

func New

func New(svc addservice.AddService, logger log.Logger, duration metrics.Histogram, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer) Set

func (Set) Concat

func (s Set) Concat(ctx context.Context, a, b string) (string, error)

func (Set) Sum

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

type SumRequest

type SumRequest struct {
	A, B int
}

type SumResponse

type SumResponse struct {
	V   int   `json:"v"`
	Err error `json:"-"` // should be intercepted by Failed/errorEncoder
}

func (SumResponse) Failed

func (r SumResponse) Failed() error

Jump to

Keyboard shortcuts

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