service

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLang = errors.New("Invalid Lang for output")
)

自定义错误类型

Functions

This section is empty.

Types

type Middleware

type Middleware func(Service) Service

Middleware 中间件对象定义,需要实现服务的接口定义,并返回服务对象

func InstrumentingMiddleware

func InstrumentingMiddleware(helloInts, goodbyInts metrics.Counter) Middleware

InstrumentingMiddleware 度量中间件定义方法

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

LoggingMiddleware 日志中间件定义方法

type Service

type Service interface {
	SayHello(ctx context.Context, lang, target string) (string, error)
	SayGoodby(ctx context.Context, lang, target string) (string, error)
}

Service 服务接口定义

func New

func New(logger log.Logger, successInts, failInts metrics.Counter) Service

New 新建服务方法,包含对非功能性中间件的添加

func NewBasicService

func NewBasicService() Service

NewBasicService 新建服务方法,仅实现业务自身部分

Jump to

Keyboard shortcuts

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