endpoint

package
v0.0.0-...-7dbc1ad Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT Imports: 9 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 MakeCreateUserEndpoint

func MakeCreateUserEndpoint(s service.Service) endpoint.Endpoint

MakeCreateUserEndpoint constructs a CreateUser endpoint wrapping the service.

Types

type CreateUserRequest

type CreateUserRequest struct {
	// contains filtered or unexported fields
}

CreateUserRequest collects the request parameters for the CreateUser method.

type CreateUserResponse

type CreateUserResponse struct {
	ID  string `json:"id"`
	Err error  `json:"-"` // should be intercepted by Failed/errorEncoder
}

CreateUserResponse collects the response values for the CreateUser method.

func (CreateUserResponse) Failed

func (r CreateUserResponse) Failed() error

Failed implements endpoint.Failer.

type Set

type Set struct {
	CreateUserEndpoint 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(srv service.Service, logger log.Logger, duration metrics.Histogram, otTracer stdopentracing.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) CreateUser

func (s Set) CreateUser(ctx context.Context, email string, password string) (string, error)

CreateUser 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