1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- // Package v1 Code generated by go-common/app/tool/protoc-gen-bm. DO NOT EDIT.
- package v1
- import (
- "context"
- bm "go-common/library/net/http/blademaster"
- )
- // BMHelloServer interface as same as gGRPC server define
- type BMHelloServer interface {
- SayHello(context.Context, *HelloRequest) (*HelloReply, error)
- Echo(context.Context, *EchoRequest) (*EchoReply, error)
- }
- // _BMServerHelloserver
- type _BMServerHello struct {
- BMHelloServer
- }
- func (b *_BMServerHello) bmHelloSayHelloHandler(c *bm.Context) {
- req := new(HelloRequest)
- if err := c.Bind(req); err != nil {
- return
- }
- reply, err := b.SayHello(c.Context, req)
- c.JSON(reply, err)
- }
- func (b *_BMServerHello) bmHelloEchoHandler(c *bm.Context) {
- req := new(EchoRequest)
- if err := c.Bind(req); err != nil {
- return
- }
- reply, err := b.Echo(c.Context, req)
- c.JSON(reply, err)
- }
- // RegisterHelloBMServer register bm server
- func RegisterHelloBMServer(e *bm.Engine, s BMHelloServer) {
- bs := &_BMServerHello{s}
- e.GET("/hello", bs.bmHelloSayHelloHandler)
- e.POST("/echo", bs.bmHelloEchoHandler)
- }
|