Go-kit example: support services without unary calls
This commit is contained in:
parent
cdb9580565
commit
877e93aa7c
@ -10,7 +10,9 @@ import (
|
|||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = endpoint.Chain
|
||||||
var _ = fmt.Errorf
|
var _ = fmt.Errorf
|
||||||
|
var _ = context.Background
|
||||||
|
|
||||||
type StreamEndpoint func(server interface{}, req interface{}) (err error)
|
type StreamEndpoint func(server interface{}, req interface{}) (err error)
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ import (
|
|||||||
var _ = fmt.Errorf
|
var _ = fmt.Errorf
|
||||||
|
|
||||||
func MakeGRPCServer(ctx context.Context, endpoints endpoints.Endpoints) pb.{{.File.Package | title}}ServiceServer {
|
func MakeGRPCServer(ctx context.Context, endpoints endpoints.Endpoints) pb.{{.File.Package | title}}ServiceServer {
|
||||||
options := []grpctransport.ServerOption{}
|
var options []grpctransport.ServerOption
|
||||||
|
_ = options
|
||||||
return &grpcServer{
|
return &grpcServer{
|
||||||
{{range .Service.Method}}
|
{{range .Service.Method}}
|
||||||
{{if or (.ClientStreaming) (.ServerStreaming)}}
|
{{if or (.ClientStreaming) (.ServerStreaming)}}
|
||||||
|
@ -14,6 +14,11 @@ import (
|
|||||||
endpoints "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/endpoints"
|
endpoints "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/endpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = log.Printf
|
||||||
|
var _ = gokit_endpoint.Chain
|
||||||
|
var _ = httptransport.NewClient
|
||||||
|
|
||||||
|
|
||||||
{{range .Service.Method}}
|
{{range .Service.Method}}
|
||||||
{{if and (not .ServerStreaming) (not .ClientStreaming)}}
|
{{if and (not .ServerStreaming) (not .ClientStreaming)}}
|
||||||
func Make{{.Name}}Handler(ctx context.Context, svc pb.{{$file.Package | title}}ServiceServer, endpoint gokit_endpoint.Endpoint) *httptransport.Server {
|
func Make{{.Name}}Handler(ctx context.Context, svc pb.{{$file.Package | title}}ServiceServer, endpoint gokit_endpoint.Endpoint) *httptransport.Server {
|
||||||
|
Loading…
Reference in New Issue
Block a user