endpoint

package
v0.0.0-...-d11ffb8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: MIT Imports: 9 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 MakeDeleteEndpoint

func MakeDeleteEndpoint(s service.PostsService) endpoint.Endpoint

MakeDeleteEndpoint returns an endpoint that invokes Delete on the service.

func MakeListEndpoint

func MakeListEndpoint(s service.PostsService) endpoint.Endpoint

MakeListEndpoint returns an endpoint that invokes List on the service.

func MakeStoreEndpoint

func MakeStoreEndpoint(s service.PostsService) endpoint.Endpoint

MakeStoreEndpoint returns an endpoint that invokes Store on the service.

func MakeUpdateEndpoint

func MakeUpdateEndpoint(s service.PostsService) endpoint.Endpoint

MakeUpdateEndpoint returns an endpoint that invokes Update on the service.

Types

type DeleteRequest

type DeleteRequest struct {
	Post model.Post `json:"post"`
}

DeleteRequest collects the request parameters for the Delete method.

type DeleteResponse

type DeleteResponse struct {
	Response string `json:"response"`
	Err      error  `json:"err"`
}

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 {
	StoreEndpoint  endpoint.Endpoint
	UpdateEndpoint endpoint.Endpoint
	ListEndpoint   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) Delete

func (e Endpoints) Delete(ctx context.Context, post model.Post) (response string, err error)

Delete implements Service. Primarily useful in a client.

func (Endpoints) List

func (e Endpoints) List(ctx context.Context, post model.Post) (response []*pb.Post, err error)

List implements Service. Primarily useful in a client.

func (Endpoints) Store

func (e Endpoints) Store(ctx context.Context, post model.Post) (response string, err error)

Store implements Service. Primarily useful in a client.

func (Endpoints) Update

func (e Endpoints) Update(ctx context.Context, post model.Post) (response string, err error)

Update implements Service. Primarily useful in a client.

type Failure

type Failure interface {
	Failed() error
}

Failure 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 ListRequest

type ListRequest struct {
	Post model.Post `json:"post"`
}

ListRequest collects the request parameters for the List method.

type ListResponse

type ListResponse struct {
	Response []*pb.Post `json:"response"`
	Err      error      `json:"err"`
}

ListResponse collects the response parameters for the List method.

func (ListResponse) Failed

func (r ListResponse) Failed() error

Failed implements Failer.

type StoreRequest

type StoreRequest struct {
	Post model.Post `json:"post"`
}

StoreRequest collects the request parameters for the Store method.

type StoreResponse

type StoreResponse struct {
	Response string `json:"response"`
	Err      error  `json:"err"`
}

StoreResponse collects the response parameters for the Store method.

func (StoreResponse) Failed

func (r StoreResponse) Failed() error

Failed implements Failer.

type UpdateRequest

type UpdateRequest struct {
	Post model.Post `json:"post"`
}

UpdateRequest collects the request parameters for the Update method.

type UpdateResponse

type UpdateResponse struct {
	Response string `json:"response"`
	Err      error  `json:"err"`
}

UpdateResponse collects the response parameters for the Update method.

func (UpdateResponse) Failed

func (r UpdateResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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