helloworld.pb.bm.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Package v1 Code generated by go-common/app/tool/protoc-gen-bm. DO NOT EDIT.
  2. package v1
  3. import (
  4. "context"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. // BMHelloServer interface as same as gGRPC server define
  8. type BMHelloServer interface {
  9. SayHello(context.Context, *HelloRequest) (*HelloReply, error)
  10. Echo(context.Context, *EchoRequest) (*EchoReply, error)
  11. }
  12. // _BMServerHelloserver
  13. type _BMServerHello struct {
  14. BMHelloServer
  15. }
  16. func (b *_BMServerHello) bmHelloSayHelloHandler(c *bm.Context) {
  17. req := new(HelloRequest)
  18. if err := c.Bind(req); err != nil {
  19. return
  20. }
  21. reply, err := b.SayHello(c.Context, req)
  22. c.JSON(reply, err)
  23. }
  24. func (b *_BMServerHello) bmHelloEchoHandler(c *bm.Context) {
  25. req := new(EchoRequest)
  26. if err := c.Bind(req); err != nil {
  27. return
  28. }
  29. reply, err := b.Echo(c.Context, req)
  30. c.JSON(reply, err)
  31. }
  32. // RegisterHelloBMServer register bm server
  33. func RegisterHelloBMServer(e *bm.Engine, s BMHelloServer) {
  34. bs := &_BMServerHello{s}
  35. e.GET("/hello", bs.bmHelloSayHelloHandler)
  36. e.POST("/echo", bs.bmHelloEchoHandler)
  37. }