string.go 745 B

123456789101112131415161718192021222324252627
  1. package client
  2. import (
  3. grpctransport "github.com/go-kit/kit/transport/grpc"
  4. kitgrpc "github.com/go-kit/kit/transport/grpc"
  5. "github.com/longjoy/micro-go-course/section35/zipkin-kit/pb"
  6. endpts "github.com/longjoy/micro-go-course/section35/zipkin-kit/string-service/endpoint"
  7. "github.com/longjoy/micro-go-course/section35/zipkin-kit/string-service/service"
  8. "google.golang.org/grpc"
  9. )
  10. func StringDiff(conn *grpc.ClientConn, clientTracer kitgrpc.ClientOption) service.Service {
  11. var ep = grpctransport.NewClient(conn,
  12. "pb.StringService",
  13. "Diff",
  14. EncodeGRPCStringRequest,
  15. DecodeGRPCStringResponse,
  16. pb.StringResponse{},
  17. clientTracer,
  18. ).Endpoint()
  19. StringEp := endpts.StringEndpoints{
  20. StringEndpoint: ep,
  21. }
  22. return StringEp
  23. }