123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
- // source: demo.proto
- /*
- Package v1 is a generated blademaster stub package.
- This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
- It is generated from these files:
- demo.proto
- */
- package v1
- import (
- "context"
- bm "go-common/library/net/http/blademaster"
- "go-common/library/net/http/blademaster/binding"
- )
- // to suppressed 'imported but not used warning'
- var _ *bm.Context
- var _ context.Context
- var _ binding.StructValidator
- var PathFooUnameByUid = "/xlive/demo/v1/foo/uname_by_uid_custom_route"
- var PathFooGetInfo = "/live.livedemo.v1.Foo/get_info"
- var PathFooUnameByUid3 = "/live.livedemo.v1.Foo/uname_by_uid3"
- var PathFooUnameByUid4 = "/live.livedemo.v1.Foo/uname_by_uid4"
- var PathFooGetDynamic = "/live.livedemo.v1.Foo/get_dynamic"
- var PathFooNointerface = "/live.livedemo.v1.Foo/nointerface"
- var PathFoo2Hello = "/live.livedemo.v1.Foo2/hello"
- // =============
- // Foo Interface
- // =============
- // Foo 相关服务
- type FooBMServer interface {
- // 根据uid得到uname
- // `method:"post" midware:"auth,verify"`
- //
- // 这是详细说明
- UnameByUid(ctx context.Context, req *Bar1Req) (resp *Bar1Resp, err error)
- // 获取房间信息
- // `midware:"guest"`
- GetInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
- // 根据uid得到uname v3
- UnameByUid3(ctx context.Context, req *Bar1Req) (resp *Bar1Resp, err error)
- // test comment
- // `internal:"true"`
- UnameByUid4(ctx context.Context, req *Bar1Req) (resp *Bar1Resp, err error)
- // `dynamic_resp:"true"`
- GetDynamic(ctx context.Context, req *Bar1Req) (resp interface{}, err error)
- }
- var v1FooSvc FooBMServer
- func fooUnameByUid(c *bm.Context) {
- p := new(Bar1Req)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1FooSvc.UnameByUid(c, p)
- c.JSON(resp, err)
- }
- func fooGetInfo(c *bm.Context) {
- p := new(GetInfoReq)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1FooSvc.GetInfo(c, p)
- c.JSON(resp, err)
- }
- func fooUnameByUid3(c *bm.Context) {
- p := new(Bar1Req)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1FooSvc.UnameByUid3(c, p)
- c.JSON(resp, err)
- }
- func fooUnameByUid4(c *bm.Context) {
- p := new(Bar1Req)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1FooSvc.UnameByUid4(c, p)
- c.JSON(resp, err)
- }
- func fooGetDynamic(c *bm.Context) {
- p := new(Bar1Req)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1FooSvc.GetDynamic(c, p)
- c.JSON(resp, err)
- }
- // RegisterV1FooService Register the blademaster route with middleware map
- // midMap is the middleware map, the key is defined in proto
- func RegisterV1FooService(e *bm.Engine, svc FooBMServer, midMap map[string]bm.HandlerFunc) {
- auth := midMap["auth"]
- guest := midMap["guest"]
- verify := midMap["verify"]
- v1FooSvc = svc
- e.GET("/xlive/demo/v1/foo/uname_by_uid_custom_route", auth, verify, fooUnameByUid)
- e.GET("/xlive/live-demo/v1/foo/get_info", guest, fooGetInfo)
- e.GET("/xlive/live-demo/v1/foo/uname_by_uid3", fooUnameByUid3)
- e.GET("/xlive/internal/live-demo/v1/foo/uname_by_uid4", fooUnameByUid4)
- e.GET("/xlive/live-demo/v1/foo/get_dynamic", fooGetDynamic)
- }
- // RegisterFooBMServer Register the blademaster route
- func RegisterFooBMServer(e *bm.Engine, server FooBMServer) {
- e.GET("/xlive/demo/v1/foo/uname_by_uid_custom_route", fooUnameByUid)
- e.GET("/live.livedemo.v1.Foo/get_info", fooGetInfo)
- e.GET("/live.livedemo.v1.Foo/uname_by_uid3", fooUnameByUid3)
- e.GET("/live.livedemo.v1.Foo/uname_by_uid4", fooUnameByUid4)
- e.GET("/live.livedemo.v1.Foo/get_dynamic", fooGetDynamic)
- }
- // ==============
- // Foo2 Interface
- // ==============
- type Foo2BMServer interface {
- Hello(ctx context.Context, req *Bar1Req) (resp *Bar1Resp, err error)
- }
- var v1Foo2Svc Foo2BMServer
- func foo2Hello(c *bm.Context) {
- p := new(Bar1Req)
- if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
- return
- }
- resp, err := v1Foo2Svc.Hello(c, p)
- c.JSON(resp, err)
- }
- // RegisterV1Foo2Service Register the blademaster route with middleware map
- // midMap is the middleware map, the key is defined in proto
- func RegisterV1Foo2Service(e *bm.Engine, svc Foo2BMServer, midMap map[string]bm.HandlerFunc) {
- v1Foo2Svc = svc
- e.GET("/xlive/live-demo/v1/foo2/hello", foo2Hello)
- }
- // RegisterFoo2BMServer Register the blademaster route
- func RegisterFoo2BMServer(e *bm.Engine, server Foo2BMServer) {
- e.GET("/live.livedemo.v1.Foo2/hello", foo2Hello)
- }
|