endpoint

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentingMiddleware

func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware

InstrumentingMiddleware 度量中间件定义方法,记录服务端点方法的执行耗时

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) endpoint.Middleware

LoggingMiddleware 日志中间件定义方法,记录服务端点方法的错误及执行耗时

func MakeSayGoodbyEndpoint

func MakeSayGoodbyEndpoint(svc service.Service) endpoint.Endpoint

MakeSayGoodbyEndpoint 创建服务端点方法

func MakeSayHelloEndpoint

func MakeSayHelloEndpoint(svc service.Service) endpoint.Endpoint

MakeSayHelloEndpoint 创建服务端点方法

Types

type SayGoodbyRequest

type SayGoodbyRequest struct {
	Lang   string
	Target string
}

SayGoodbyRequest 服务端点请求对象定义

type SayGoodbyResponse

type SayGoodbyResponse struct {
	V   string `json:"V"`
	Err error  `json:"-"` // 将由失败/错误编码器拦截
}

SayGoodbyResponse 服务端点响应对象定义

func (SayGoodbyResponse) Failed

func (r SayGoodbyResponse) Failed() error

Failed 服务端点的相应对象需要继承 endpoint.Failer 接口

type SayHelloRequest

type SayHelloRequest struct {
	Lang   string
	Target string
}

SayHelloRequest 服务端点请求对象定义

type SayHelloResponse

type SayHelloResponse struct {
	V   string `json:"V"`
	Err error  `json:"-"` // 将由失败/错误编码器拦截
}

SayHelloResponse 服务端点响应对象定义

func (SayHelloResponse) Failed

func (r SayHelloResponse) Failed() error

Failed 服务端点的相应对象需要继承 endpoint.Failer 接口

type Set

type Set struct {
	SayHelloEndpoint  endpoint.Endpoint
	SayGoodbyEndpoint endpoint.Endpoint
}

Set 服务端点集合定义

func New

func New(svc service.Service, logger log.Logger, duration metrics.Histogram, rateLimit int) Set

New 新建服务端点方法

func (Set) SayGoodby

func (s Set) SayGoodby(ctx context.Context, lang, target string) (string, error)

SayGoodby 服务端点的业务方法定义,一般情况下直接同名透传到服务层

func (Set) SayHello

func (s Set) SayHello(ctx context.Context, lang, target string) (string, error)

SayHello 服务端点的业务方法定义,一般情况下直接同名透传到服务层

Jump to

Keyboard shortcuts

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