示例#1
0
func makeHelloEndpoint(svc server.InfoService) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (interface{}, error) {
		req := request.(server.HelloRequest)
		saying, err := svc.Hello(req.Name)
		var errText string
		if err != nil {
			errText = err.Error()
		}
		return server.HelloResponse{Saying: saying, Err: errText}, nil
	}
}
示例#2
0
func makeHostEndpoint(svc server.InfoService) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (interface{}, error) {
		host, err := svc.Host()
		return host, err
	}
}