Documentation ¶
Index ¶
- func DecodeGRPCEchoRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCLouderGetRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCLouderRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeHTTPEchoOneRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPEchoZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPLouderGetZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPLouderOneRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPLouderZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func EncodeGRPCEchoResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeGRPCLouderGetResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeGRPCLouderResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func MakeEchoEndpoint(s pb.EchoServer) endpoint.Endpoint
- func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) pb.EchoServer
- func MakeHTTPHandler(endpoints Endpoints, options ...httptransport.ServerOption) http.Handler
- func MakeLouderEndpoint(s pb.EchoServer) endpoint.Endpoint
- func MakeLouderGetEndpoint(s pb.EchoServer) endpoint.Endpoint
- type Endpoints
- func (e Endpoints) Echo(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error)
- func (e Endpoints) Louder(ctx context.Context, in *pb.LouderRequest) (*pb.EchoResponse, error)
- func (e Endpoints) LouderGet(ctx context.Context, in *pb.LouderRequest) (*pb.EchoResponse, error)
- func (e *Endpoints) WrapAllExcept(middleware endpoint.Middleware, excluded ...string)
- func (e *Endpoints) WrapAllLabeledExcept(middleware func(string, endpoint.Endpoint) endpoint.Endpoint, ...)
- type LabeledMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeGRPCEchoRequest ¶
DecodeGRPCEchoRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC echo request to a user-domain echo request. Primarily useful in a server.
func DecodeGRPCLouderGetRequest ¶
DecodeGRPCLouderGetRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC louderget request to a user-domain louderget request. Primarily useful in a server.
func DecodeGRPCLouderRequest ¶
DecodeGRPCLouderRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC louder request to a user-domain louder request. Primarily useful in a server.
func DecodeHTTPEchoOneRequest ¶
DecodeHTTPEchoOneRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded echo request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPEchoZeroRequest ¶
DecodeHTTPEchoZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded echo request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPLouderGetZeroRequest ¶
DecodeHTTPLouderGetZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded louderget request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPLouderOneRequest ¶
DecodeHTTPLouderOneRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded louder request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPLouderZeroRequest ¶
DecodeHTTPLouderZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded louder request from the HTTP request body. Primarily useful in a server.
func EncodeGRPCEchoResponse ¶
EncodeGRPCEchoResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain echo response to a gRPC echo reply. Primarily useful in a server.
func EncodeGRPCLouderGetResponse ¶
EncodeGRPCLouderGetResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain louderget response to a gRPC louderget reply. Primarily useful in a server.
func EncodeGRPCLouderResponse ¶
EncodeGRPCLouderResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain louder response to a gRPC louder reply. Primarily useful in a server.
func EncodeHTTPGenericResponse ¶
func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
EncodeHTTPGenericResponse is a transport/http.EncodeResponseFunc that encodes the response as JSON to the response writer. Primarily useful in a server.
func MakeEchoEndpoint ¶
func MakeEchoEndpoint(s pb.EchoServer) endpoint.Endpoint
func MakeGRPCServer ¶
func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) pb.EchoServer
MakeGRPCServer makes a set of endpoints available as a gRPC EchoServer.
func MakeHTTPHandler ¶
func MakeHTTPHandler(endpoints Endpoints, options ...httptransport.ServerOption) http.Handler
MakeHTTPHandler returns a handler that makes a set of endpoints available on predefined paths.
func MakeLouderEndpoint ¶
func MakeLouderEndpoint(s pb.EchoServer) endpoint.Endpoint
func MakeLouderGetEndpoint ¶
func MakeLouderGetEndpoint(s pb.EchoServer) endpoint.Endpoint
Types ¶
type Endpoints ¶
type Endpoints struct { EchoEndpoint endpoint.Endpoint LouderEndpoint endpoint.Endpoint LouderGetEndpoint endpoint.Endpoint }
Endpoints 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.
In a server, it's useful for functions that need to operate on a per-endpoint basis. For example, you might pass an Endpoints to a function that produces an http.Handler, with each method (endpoint) wired up to a specific path. (It is probably a mistake in design to invoke the Service methods on the Endpoints struct in a server.)
In a client, it's useful to collect individually constructed endpoints into a single type that implements the Service interface. For example, you might construct individual endpoints using transport/http.NewClient, combine them into an Endpoints, and return it to the caller as a Service.
func (Endpoints) Echo ¶
func (e Endpoints) Echo(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error)
func (Endpoints) Louder ¶
func (e Endpoints) Louder(ctx context.Context, in *pb.LouderRequest) (*pb.EchoResponse, error)
func (Endpoints) LouderGet ¶
func (e Endpoints) LouderGet(ctx context.Context, in *pb.LouderRequest) (*pb.EchoResponse, error)
func (*Endpoints) WrapAllExcept ¶
func (e *Endpoints) WrapAllExcept(middleware endpoint.Middleware, excluded ...string)
WrapAllExcept wraps each Endpoint field of struct Endpoints with a go-kit/kit/endpoint.Middleware. Use this for applying a set of middlewares to every endpoint in the service. Optionally, endpoints can be passed in by name to be excluded from being wrapped. WrapAllExcept(middleware, "Status", "Ping")
func (*Endpoints) WrapAllLabeledExcept ¶
func (e *Endpoints) WrapAllLabeledExcept(middleware func(string, endpoint.Endpoint) endpoint.Endpoint, excluded ...string)
WrapAllLabeledExcept wraps each Endpoint field of struct Endpoints with a LabeledMiddleware, which will receive the name of the endpoint. See LabeldMiddleware. See method WrapAllExept for details on excluded functionality.
type LabeledMiddleware ¶
LabeledMiddleware will get passed the endpoint name when passed to WrapAllLabeledExcept, this can be used to write a generic metrics middleware which can send the endpoint name to the metrics collector.