endpoints

package
v0.0.1-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2017 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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 MakeWorkflowEndpoint

func MakeWorkflowEndpoint(s service.Service) endpoint.Endpoint

MakeWorkflowEndpoint returns an endpoint that invokes Workflow on the service. Primarily useful in a server.

Types

type Endpoints

type Endpoints struct {
	WorkflowGetEndpoint endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose the 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 New

func New(svc service.Service, logger log.Logger) Endpoints

New returns an Endpoints that wraps the provided server, and wires in all of the expected endpoint middlewares via the various parameters.

func (Endpoints) WorkflowGet

func (e Endpoints) WorkflowGet(ctx context.Context, id string) (*pb.WorkflowData, error)

WorkflowGet implements Service. Primarily useful in a client.

type WorkflowGetRequest

type WorkflowGetRequest struct {
	ID string
}

WorkflowGetRequest collects the request parameters for the WorkflowGet method.

type WorkflowGetResponse

type WorkflowGetResponse struct {
	Workflow *pb.WorkflowData `json:"workflow,omitempty"`
	Err      error            `json:"err,omitempty"`
}

WorkflowGetResponse collects the response values for the WorkflowGet method.

func (WorkflowGetResponse) Error

func (r WorkflowGetResponse) Error() error

Jump to

Keyboard shortcuts

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