Documentation ¶
Index ¶
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeGreetingEndpoint(s greeterservice.Service) endpoint.Endpoint
- func MakeHealthEndpoint(s greeterservice.Service) endpoint.Endpoint
- type Endpoints
- type Failer
- type GreetingRequest
- type GreetingResponse
- type HealthRequest
- type HealthResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 MakeGreetingEndpoint ¶
func MakeGreetingEndpoint(s greeterservice.Service) endpoint.Endpoint
MakeGreetingEndpoint constructs a Greeter endpoint wrapping the service.
func MakeHealthEndpoint ¶
func MakeHealthEndpoint(s greeterservice.Service) endpoint.Endpoint
MakeHealthEndpoint constructs a Health endpoint wrapping the service.
Types ¶
type Endpoints ¶
type Endpoints struct { HealthEndpoint endpoint.Endpoint // used by Consul for the healthcheck GreetingEndpoint endpoint.Endpoint }
Endpoints collects all of the endpoints that compose a greeter service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
func MakeServerEndpoints ¶
func MakeServerEndpoints(s greeterservice.Service, logger log.Logger) Endpoints
MakeServerEndpoints returns service Endoints, and wires in all the provided middlewares.
type Failer ¶
type Failer interface {
Failed() error
}
Failer is an interface that should be implemented by response types. Response encoders can check if responses are Failer, and if so if they've failed, and if so encode them using a separate write path based on the error.
type GreetingRequest ¶
type GreetingRequest struct {
Name string `json:"name,omitempty"`
}
GreetingRequest collects the request parameters for the Greeting method.
type GreetingResponse ¶
type GreetingResponse struct { Greeting string `json:"greeting,omitempty"` Err error `json:"err,omitempty"` }
GreetingResponse collects the response values for the Greeting method.
type HealthRequest ¶
type HealthRequest struct{}
HealthRequest collects the request parameters for the Health method.
type HealthResponse ¶
type HealthResponse struct { Healthy bool `json:"healthy,omitempty"` Err error `json:"err,omitempty"` }
HealthResponse collects the response values for the Health method.