rcvr.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package impl
  4. import (
  5. "context"
  6. "property-log/impl/v1/log"
  7. "property-log/pb"
  8. pb_v1 "property-log/pb/v1"
  9. "git.getensh.com/common/gopkgs/tasker/rpctasker"
  10. "google.golang.org/grpc"
  11. )
  12. // 具体实现
  13. type Rcvr struct {
  14. }
  15. func Register(s *grpc.Server) {
  16. pb.RegisterPropertyLogServer(s, &Rcvr{})
  17. }
  18. //
  19. func (c *Rcvr) CompanyLogAdd(ctx context.Context, req *pb_v1.CompanyLogAddRequest) (reply *pb_v1.CompanyLogAddReply, err error) {
  20. t1 := func() error {
  21. reply, err = log.CompanyLogAdd(ctx, req)
  22. return err
  23. }
  24. return reply, rpctasker.Exec(ctx, t1)
  25. }
  26. func (c *Rcvr) CompanyLog(ctx context.Context, req *pb_v1.CompanyLogRequest) (reply *pb_v1.CompanyLogReply, err error) {
  27. t1 := func() error {
  28. reply, err = log.CompanyLog(ctx, req)
  29. return err
  30. }
  31. return reply, rpctasker.Exec(ctx, t1)
  32. }
  33. func (c *Rcvr) SystemLogAdd(ctx context.Context, req *pb_v1.SystemLogAddRequest) (reply *pb_v1.SystemLogAddReply, err error) {
  34. t1 := func() error {
  35. reply, err = log.SystemLogAdd(ctx, req)
  36. return err
  37. }
  38. return reply, rpctasker.Exec(ctx, t1)
  39. }
  40. func (c *Rcvr) SystemLog(ctx context.Context, req *pb_v1.SystemLogRequest) (reply *pb_v1.SystemLogReply, err error) {
  41. t1 := func() error {
  42. reply, err = log.SystemLog(ctx, req)
  43. return err
  44. }
  45. return reply, rpctasker.Exec(ctx, t1)
  46. }
  47. func (c *Rcvr) ManagementLogAdd(ctx context.Context, req *pb_v1.ManagementLogAddRequest) (reply *pb_v1.ManagementLogAddReply, err error) {
  48. t1 := func() error {
  49. reply, err = log.ManagementLogAdd(ctx, req)
  50. return err
  51. }
  52. return reply, rpctasker.Exec(ctx, t1)
  53. }
  54. func (c *Rcvr) ManagementLog(ctx context.Context, req *pb_v1.ManagementLogRequest) (reply *pb_v1.ManagementLogReply, err error) {
  55. t1 := func() error {
  56. reply, err = log.ManagementLog(ctx, req)
  57. return err
  58. }
  59. return reply, rpctasker.Exec(ctx, t1)
  60. }