service.go 557 B

1234567891011121314151617181920212223242526
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/tool/protoc-gen-bm/examples/helloworld/api"
  6. )
  7. // Service .
  8. type Service struct{}
  9. var _ v1.HelloServer = &Service{}
  10. var _ v1.BMHelloServer = &Service{}
  11. // SayHello .
  12. func (s *Service) SayHello(ctx context.Context, req *v1.HelloRequest) (*v1.HelloReply, error) {
  13. return &v1.HelloReply{
  14. Message: fmt.Sprintf("hello %s", req.Name),
  15. }, nil
  16. }
  17. // Echo .
  18. func (s *Service) Echo(ctx context.Context, req *v1.EchoRequest) (*v1.EchoReply, error) {
  19. return &v1.EchoReply{Content: req.Content}, nil
  20. }