foo.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package livedemo
  2. import (
  3. "context"
  4. pb "go-common/app/interface/live/live-demo/api/http"
  5. "go-common/app/interface/live/live-demo/conf"
  6. )
  7. // FooService struct
  8. type FooService struct {
  9. conf *conf.Config
  10. // optionally add other properties here, such as dao
  11. // dao *dao.Dao
  12. }
  13. //NewFooService init
  14. func NewFooService(c *conf.Config) (s *FooService) {
  15. s = &FooService{
  16. conf: c,
  17. }
  18. return s
  19. }
  20. // Foo 相关服务
  21. // UnameByUid implementation
  22. // 根据uid得到uname
  23. // `method:"post" midware:"auth,verify"`
  24. //
  25. // 这是详细说明
  26. func (s *FooService) UnameByUid(ctx context.Context, req *pb.Bar1Req) (resp *pb.Bar1Resp, err error) {
  27. resp = &pb.Bar1Resp{}
  28. return
  29. }
  30. // GetInfo implementation
  31. // 获取房间信息
  32. // `midware:"guest"`
  33. func (s *FooService) GetInfo(ctx context.Context, req *pb.GetInfoReq) (resp *pb.GetInfoResp, err error) {
  34. resp = &pb.GetInfoResp{}
  35. return
  36. }
  37. // UnameByUid3 implementation
  38. // 根据uid得到uname v3
  39. func (s *FooService) UnameByUid3(ctx context.Context, req *pb.Bar1Req) (resp *pb.Bar1Resp, err error) {
  40. resp = &pb.Bar1Resp{}
  41. return
  42. }
  43. // UnameByUid4 implementation
  44. // test comment
  45. // `internal:"true"`
  46. func (s *FooService) UnameByUid4(ctx context.Context, req *pb.Bar1Req) (resp *pb.Bar1Resp, err error) {
  47. resp = &pb.Bar1Resp{}
  48. return
  49. }
  50. // GetDynamic implementation
  51. // `dynamic_resp:"true"`
  52. func (s *FooService) GetDynamic(ctx context.Context, req *pb.Bar1Req) (resp interface{}, err error) {
  53. resp = &pb.Bar1Resp{}
  54. return
  55. }
  56. // Nointerface implementation
  57. // `dynamic:"true"`
  58. func (s *FooService) Nointerface(ctx context.Context, req *pb.Bar1Req) (resp *pb.Bar1Resp, err error) {
  59. resp = &pb.Bar1Resp{}
  60. return
  61. }