svc

package
v0.0.0-...-f1b8dfb Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: Unlicense Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGRPCCheckListWebhookRequest

func DecodeGRPCCheckListWebhookRequest(_ context.Context, grpcReq interface{}) (interface{}, error)

DecodeGRPCCheckListWebhookRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC checklistwebhook request to a user-domain checklistwebhook request. Primarily useful in a server.

func DecodeGRPCEmptyRPCRequest

func DecodeGRPCEmptyRPCRequest(_ context.Context, grpcReq interface{}) (interface{}, error)

DecodeGRPCEmptyRPCRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC emptyrpc request to a user-domain emptyrpc request. Primarily useful in a server.

func DecodeHTTPCheckListWebhookZeroRequest

func DecodeHTTPCheckListWebhookZeroRequest(_ context.Context, r *http.Request) (interface{}, error)

DecodeHTTPCheckListWebhookZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded checklistwebhook request from the HTTP request body. Primarily useful in a server.

func EncodeGRPCCheckListWebhookResponse

func EncodeGRPCCheckListWebhookResponse(_ context.Context, response interface{}) (interface{}, error)

EncodeGRPCCheckListWebhookResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain checklistwebhook response to a gRPC checklistwebhook reply. Primarily useful in a server.

func EncodeGRPCEmptyRPCResponse

func EncodeGRPCEmptyRPCResponse(_ context.Context, response interface{}) (interface{}, error)

EncodeGRPCEmptyRPCResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain emptyrpc response to a gRPC emptyrpc 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 MakeCheckListWebhookEndpoint

func MakeCheckListWebhookEndpoint(s pb.RelloServer) endpoint.Endpoint

func MakeEmptyRPCEndpoint

func MakeEmptyRPCEndpoint(s pb.RelloServer) endpoint.Endpoint

func MakeGRPCServer

func MakeGRPCServer(endpoints Endpoints) pb.RelloServer

MakeGRPCServer makes a set of endpoints available as a gRPC RelloServer.

func MakeHTTPHandler

func MakeHTTPHandler(endpoints Endpoints) http.Handler

MakeHTTPHandler returns a handler that makes a set of endpoints available on predefined paths.

Types

type Endpoints

type Endpoints struct {
	CheckListWebhookEndpoint endpoint.Endpoint
	EmptyRPCEndpoint         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) CheckListWebhook

func (e Endpoints) CheckListWebhook(ctx context.Context, in *pb.ChecklistUpdate) (*pb.Empty, error)

func (Endpoints) EmptyRPC

func (e Endpoints) EmptyRPC(ctx context.Context, in *pb.Empty) (*pb.Empty, 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 HTTPBody

type HTTPBody struct{}

type LabeledMiddleware

type LabeledMiddleware func(string, endpoint.Endpoint) endpoint.Endpoint

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.

Directories

Path Synopsis
client
grpc
Package grpc provides a gRPC client for the Rello service.
Package grpc provides a gRPC client for the Rello service.
http
Package http provides an HTTP client for the Rello service.
Package http provides an HTTP client for the Rello service.
cli

Jump to

Keyboard shortcuts

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