endpoint

package
v0.0.0-...-866daa0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!!

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 MakeAddEndpoint

func MakeAddEndpoint(s service.TodoService) endpoint.Endpoint

MakeAddEndpoint returns an endpoint that invokes Add on the service.

func MakeDeleteEndpoint

func MakeDeleteEndpoint(s service.TodoService) endpoint.Endpoint

MakeDeleteEndpoint returns an endpoint that invokes Delete on the service.

func MakeGetEndpoint

func MakeGetEndpoint(s service.TodoService) endpoint.Endpoint

MakeGetEndpoint returns an endpoint that invokes Get on the service.

func MakeRemoveCompleteEndpoint

func MakeRemoveCompleteEndpoint(s service.TodoService) endpoint.Endpoint

MakeRemoveCompleteEndpoint returns an endpoint that invokes RemoveComplete on the service.

func MakeSetCompleteEndpoint

func MakeSetCompleteEndpoint(s service.TodoService) endpoint.Endpoint

MakeSetCompleteEndpoint returns an endpoint that invokes SetComplete on the service.

Types

type AddRequest

type AddRequest struct {
	Todo io.Todo `json:"todo"`
}

AddRequest collects the request parameters for the Add method.

type AddResponse

type AddResponse struct {
	T     io.Todo `json:"t"`
	Error error   `json:"error"`
}

AddResponse collects the response parameters for the Add method.

func (AddResponse) Failed

func (r AddResponse) Failed() error

Failed implements Failer.

type DeleteRequest

type DeleteRequest struct {
	Id string `json:"id"`
}

DeleteRequest collects the request parameters for the Delete method.

type DeleteResponse

type DeleteResponse struct {
	Error error `json:"error"`
}

DeleteResponse collects the response parameters for the Delete method.

func (DeleteResponse) Failed

func (r DeleteResponse) Failed() error

Failed implements Failer.

type Endpoints

type Endpoints struct {
	GetEndpoint            endpoint.Endpoint
	AddEndpoint            endpoint.Endpoint
	SetCompleteEndpoint    endpoint.Endpoint
	RemoveCompleteEndpoint endpoint.Endpoint
	DeleteEndpoint         endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose a profile service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func New

New returns a Endpoints struct that wraps the provided service, and wires in all of the expected endpoint middlewares

func (Endpoints) Add

func (e Endpoints) Add(ctx context.Context, todo io.Todo) (t io.Todo, error error)

Add implements Service. Primarily useful in a client.

func (Endpoints) Delete

func (e Endpoints) Delete(ctx context.Context, id string) (error error)

Delete implements Service. Primarily useful in a client.

func (Endpoints) Get

func (e Endpoints) Get(ctx context.Context) (t []io.Todo, error error)

Get implements Service. Primarily useful in a client.

func (Endpoints) RemoveComplete

func (e Endpoints) RemoveComplete(ctx context.Context, id string) (error error)

RemoveComplete implements Service. Primarily useful in a client.

func (Endpoints) SetComplete

func (e Endpoints) SetComplete(ctx context.Context, id string) (error error)

SetComplete implements Service. Primarily useful in a client.

type Failure

type Failure 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 they've failed, and if so encode them using a separate write path based on the error.

type GetRequest

type GetRequest struct{}

GetRequest collects the request parameters for the Get method.

type GetResponse

type GetResponse struct {
	T     []io.Todo `json:"t"`
	Error error     `json:"error"`
}

GetResponse collects the response parameters for the Get method.

func (GetResponse) Failed

func (r GetResponse) Failed() error

Failed implements Failer.

type RemoveCompleteRequest

type RemoveCompleteRequest struct {
	Id string `json:"id"`
}

RemoveCompleteRequest collects the request parameters for the RemoveComplete method.

type RemoveCompleteResponse

type RemoveCompleteResponse struct {
	Error error `json:"error"`
}

RemoveCompleteResponse collects the response parameters for the RemoveComplete method.

func (RemoveCompleteResponse) Failed

func (r RemoveCompleteResponse) Failed() error

Failed implements Failer.

type SetCompleteRequest

type SetCompleteRequest struct {
	Id string `json:"id"`
}

SetCompleteRequest collects the request parameters for the SetComplete method.

type SetCompleteResponse

type SetCompleteResponse struct {
	Error error `json:"error"`
}

SetCompleteResponse collects the response parameters for the SetComplete method.

func (SetCompleteResponse) Failed

func (r SetCompleteResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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