采购管理员接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
4.9 KiB

1 year ago
  1. // Code generated by protoc-gen-go.
  2. // source: admin.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package adminrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. admin.proto
  8. It has these top-level messages:
  9. Request
  10. Response
  11. */
  12. package adminrpc
  13. import proto "github.com/chai2010/protorpc/proto"
  14. import math "math"
  15. import "io"
  16. import "log"
  17. import "net"
  18. import "net/rpc"
  19. import "time"
  20. import protorpc "github.com/chai2010/protorpc"
  21. // Reference imports to suppress errors if they are not otherwise used.
  22. var _ = proto.Marshal
  23. var _ = math.Inf
  24. // 信息请求结构
  25. type Request struct {
  26. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  27. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  28. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  29. XXX_unrecognized []byte `json:"-"`
  30. }
  31. func (m *Request) Reset() { *m = Request{} }
  32. func (m *Request) String() string { return proto.CompactTextString(m) }
  33. func (*Request) ProtoMessage() {}
  34. func (m *Request) GetData() string {
  35. if m != nil && m.Data != nil {
  36. return *m.Data
  37. }
  38. return ""
  39. }
  40. func (m *Request) GetTime() string {
  41. if m != nil && m.Time != nil {
  42. return *m.Time
  43. }
  44. return ""
  45. }
  46. func (m *Request) GetSign() string {
  47. if m != nil && m.Sign != nil {
  48. return *m.Sign
  49. }
  50. return ""
  51. }
  52. // 信息响应结构
  53. type Response struct {
  54. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  55. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  56. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  57. XXX_unrecognized []byte `json:"-"`
  58. }
  59. func (m *Response) Reset() { *m = Response{} }
  60. func (m *Response) String() string { return proto.CompactTextString(m) }
  61. func (*Response) ProtoMessage() {}
  62. func (m *Response) GetData() string {
  63. if m != nil && m.Data != nil {
  64. return *m.Data
  65. }
  66. return ""
  67. }
  68. func (m *Response) GetTime() string {
  69. if m != nil && m.Time != nil {
  70. return *m.Time
  71. }
  72. return ""
  73. }
  74. func (m *Response) GetSign() string {
  75. if m != nil && m.Sign != nil {
  76. return *m.Sign
  77. }
  78. return ""
  79. }
  80. func init() {
  81. }
  82. type AdminService interface {
  83. GetByToken(in *Request, out *Response) error
  84. }
  85. // AcceptAdminServiceClient accepts connections on the listener and serves requests
  86. // for each incoming connection. Accept blocks; the caller typically
  87. // invokes it in a go statement.
  88. func AcceptAdminServiceClient(lis net.Listener, x AdminService) {
  89. srv := rpc.NewServer()
  90. if err := srv.RegisterName("AdminService", x); err != nil {
  91. log.Fatal(err)
  92. }
  93. for {
  94. conn, err := lis.Accept()
  95. if err != nil {
  96. log.Fatalf("lis.Accept(): %v\n", err)
  97. }
  98. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  99. }
  100. }
  101. // RegisterAdminService publish the given AdminService implementation on the server.
  102. func RegisterAdminService(srv *rpc.Server, x AdminService) error {
  103. if err := srv.RegisterName("AdminService", x); err != nil {
  104. return err
  105. }
  106. return nil
  107. }
  108. // NewAdminServiceServer returns a new AdminService Server.
  109. func NewAdminServiceServer(x AdminService) *rpc.Server {
  110. srv := rpc.NewServer()
  111. if err := srv.RegisterName("AdminService", x); err != nil {
  112. log.Fatal(err)
  113. }
  114. return srv
  115. }
  116. // ListenAndServeAdminService listen announces on the local network address laddr
  117. // and serves the given AdminService implementation.
  118. func ListenAndServeAdminService(network, addr string, x AdminService) error {
  119. lis, err := net.Listen(network, addr)
  120. if err != nil {
  121. return err
  122. }
  123. defer lis.Close()
  124. srv := rpc.NewServer()
  125. if err := srv.RegisterName("AdminService", x); err != nil {
  126. return err
  127. }
  128. for {
  129. conn, err := lis.Accept()
  130. if err != nil {
  131. log.Fatalf("lis.Accept(): %v\n", err)
  132. }
  133. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  134. }
  135. }
  136. type AdminServiceClient struct {
  137. *rpc.Client
  138. }
  139. // NewAdminServiceClient returns a AdminService rpc.Client and stub to handle
  140. // requests to the set of AdminService at the other end of the connection.
  141. func NewAdminServiceClient(conn io.ReadWriteCloser) (*AdminServiceClient, *rpc.Client) {
  142. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  143. return &AdminServiceClient{c}, c
  144. }
  145. func (c *AdminServiceClient) GetByToken(in *Request, out *Response) error {
  146. return c.Call("AdminService.GetByToken", in, out)
  147. }
  148. // DialAdminService connects to an AdminService at the specified network address.
  149. func DialAdminService(network, addr string) (*AdminServiceClient, *rpc.Client, error) {
  150. c, err := protorpc.Dial(network, addr)
  151. if err != nil {
  152. return nil, nil, err
  153. }
  154. return &AdminServiceClient{c}, c, nil
  155. }
  156. // DialAdminServiceTimeout connects to an AdminService at the specified network address.
  157. func DialAdminServiceTimeout(network, addr string,
  158. timeout time.Duration) (*AdminServiceClient, *rpc.Client, error) {
  159. c, err := protorpc.DialTimeout(network, addr, timeout)
  160. if err != nil {
  161. return nil, nil, err
  162. }
  163. return &AdminServiceClient{c}, c, nil
  164. }