demo.pb.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: demo.proto
  3. //声明 包名
  4. package proto
  5. import (
  6. context "context"
  7. fmt "fmt"
  8. proto "github.com/golang/protobuf/proto"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. math "math"
  13. )
  14. // Reference imports to suppress errors if they are not otherwise used.
  15. var _ = proto.Marshal
  16. var _ = fmt.Errorf
  17. var _ = math.Inf
  18. // This is a compile-time assertion to ensure that this generated file
  19. // is compatible with the proto package it is being compiled against.
  20. // A compilation error at this line likely means your copy of the
  21. // proto package needs to be updated.
  22. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
  23. //服务参数
  24. type DemoReq struct {
  25. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  26. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  27. XXX_unrecognized []byte `json:"-"`
  28. XXX_sizecache int32 `json:"-"`
  29. }
  30. func (m *DemoReq) Reset() { *m = DemoReq{} }
  31. func (m *DemoReq) String() string { return proto.CompactTextString(m) }
  32. func (*DemoReq) ProtoMessage() {}
  33. func (*DemoReq) Descriptor() ([]byte, []int) {
  34. return fileDescriptor_ca53982754088a9d, []int{0}
  35. }
  36. func (m *DemoReq) XXX_Unmarshal(b []byte) error {
  37. return xxx_messageInfo_DemoReq.Unmarshal(m, b)
  38. }
  39. func (m *DemoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  40. return xxx_messageInfo_DemoReq.Marshal(b, m, deterministic)
  41. }
  42. func (m *DemoReq) XXX_Merge(src proto.Message) {
  43. xxx_messageInfo_DemoReq.Merge(m, src)
  44. }
  45. func (m *DemoReq) XXX_Size() int {
  46. return xxx_messageInfo_DemoReq.Size(m)
  47. }
  48. func (m *DemoReq) XXX_DiscardUnknown() {
  49. xxx_messageInfo_DemoReq.DiscardUnknown(m)
  50. }
  51. var xxx_messageInfo_DemoReq proto.InternalMessageInfo
  52. func (m *DemoReq) GetName() string {
  53. if m != nil {
  54. return m.Name
  55. }
  56. return ""
  57. }
  58. //标准字符串返回结果
  59. type DemoRep struct {
  60. Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
  61. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  62. XXX_unrecognized []byte `json:"-"`
  63. XXX_sizecache int32 `json:"-"`
  64. }
  65. func (m *DemoRep) Reset() { *m = DemoRep{} }
  66. func (m *DemoRep) String() string { return proto.CompactTextString(m) }
  67. func (*DemoRep) ProtoMessage() {}
  68. func (*DemoRep) Descriptor() ([]byte, []int) {
  69. return fileDescriptor_ca53982754088a9d, []int{1}
  70. }
  71. func (m *DemoRep) XXX_Unmarshal(b []byte) error {
  72. return xxx_messageInfo_DemoRep.Unmarshal(m, b)
  73. }
  74. func (m *DemoRep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  75. return xxx_messageInfo_DemoRep.Marshal(b, m, deterministic)
  76. }
  77. func (m *DemoRep) XXX_Merge(src proto.Message) {
  78. xxx_messageInfo_DemoRep.Merge(m, src)
  79. }
  80. func (m *DemoRep) XXX_Size() int {
  81. return xxx_messageInfo_DemoRep.Size(m)
  82. }
  83. func (m *DemoRep) XXX_DiscardUnknown() {
  84. xxx_messageInfo_DemoRep.DiscardUnknown(m)
  85. }
  86. var xxx_messageInfo_DemoRep proto.InternalMessageInfo
  87. func (m *DemoRep) GetData() string {
  88. if m != nil {
  89. return m.Data
  90. }
  91. return ""
  92. }
  93. func init() {
  94. proto.RegisterType((*DemoReq)(nil), "proto.DemoReq")
  95. proto.RegisterType((*DemoRep)(nil), "proto.DemoRep")
  96. }
  97. func init() {
  98. proto.RegisterFile("demo.proto", fileDescriptor_ca53982754088a9d)
  99. }
  100. var fileDescriptor_ca53982754088a9d = []byte{
  101. // 118 bytes of a gzipped FileDescriptorProto
  102. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x49, 0xcd, 0xcd,
  103. 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0xb2, 0x5c, 0xec, 0x2e, 0xa9,
  104. 0xb9, 0xf9, 0x41, 0xa9, 0x85, 0x42, 0x42, 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a,
  105. 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0x36, 0x42, 0xba, 0x00, 0x24, 0x9d, 0x92, 0x58, 0x92, 0x08, 0x93,
  106. 0x06, 0xb1, 0x8d, 0xcc, 0xb8, 0xb8, 0x41, 0xd2, 0xc1, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x42,
  107. 0xea, 0x5c, 0xcc, 0xc1, 0x89, 0x95, 0x42, 0x7c, 0x10, 0x2b, 0xf4, 0xa0, 0x06, 0x4b, 0xa1, 0xf2,
  108. 0x0b, 0x94, 0x18, 0x92, 0xd8, 0xc0, 0x02, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xd5,
  109. 0xa7, 0x42, 0x91, 0x00, 0x00, 0x00,
  110. }
  111. // Reference imports to suppress errors if they are not otherwise used.
  112. var _ context.Context
  113. var _ grpc.ClientConnInterface
  114. // This is a compile-time assertion to ensure that this generated file
  115. // is compatible with the grpc package it is being compiled against.
  116. const _ = grpc.SupportPackageIsVersion6
  117. // DemoServiceClient is the client API for DemoService service.
  118. //
  119. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  120. type DemoServiceClient interface {
  121. //rpc
  122. Say(ctx context.Context, in *DemoReq, opts ...grpc.CallOption) (*DemoRep, error)
  123. }
  124. type demoServiceClient struct {
  125. cc grpc.ClientConnInterface
  126. }
  127. func NewDemoServiceClient(cc grpc.ClientConnInterface) DemoServiceClient {
  128. return &demoServiceClient{cc}
  129. }
  130. func (c *demoServiceClient) Say(ctx context.Context, in *DemoReq, opts ...grpc.CallOption) (*DemoRep, error) {
  131. out := new(DemoRep)
  132. err := c.cc.Invoke(ctx, "/proto.DemoService/Say", in, out, opts...)
  133. if err != nil {
  134. return nil, err
  135. }
  136. return out, nil
  137. }
  138. // DemoServiceServer is the server API for DemoService service.
  139. type DemoServiceServer interface {
  140. //rpc
  141. Say(context.Context, *DemoReq) (*DemoRep, error)
  142. }
  143. // UnimplementedDemoServiceServer can be embedded to have forward compatible implementations.
  144. type UnimplementedDemoServiceServer struct {
  145. }
  146. func (*UnimplementedDemoServiceServer) Say(ctx context.Context, req *DemoReq) (*DemoRep, error) {
  147. return nil, status.Errorf(codes.Unimplemented, "method Say not implemented")
  148. }
  149. func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer) {
  150. s.RegisterService(&_DemoService_serviceDesc, srv)
  151. }
  152. func _DemoService_Say_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  153. in := new(DemoReq)
  154. if err := dec(in); err != nil {
  155. return nil, err
  156. }
  157. if interceptor == nil {
  158. return srv.(DemoServiceServer).Say(ctx, in)
  159. }
  160. info := &grpc.UnaryServerInfo{
  161. Server: srv,
  162. FullMethod: "/proto.DemoService/Say",
  163. }
  164. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  165. return srv.(DemoServiceServer).Say(ctx, req.(*DemoReq))
  166. }
  167. return interceptor(ctx, in, info, handler)
  168. }
  169. var _DemoService_serviceDesc = grpc.ServiceDesc{
  170. ServiceName: "proto.DemoService",
  171. HandlerType: (*DemoServiceServer)(nil),
  172. Methods: []grpc.MethodDesc{
  173. {
  174. MethodName: "Say",
  175. Handler: _DemoService_Say_Handler,
  176. },
  177. },
  178. Streams: []grpc.StreamDesc{},
  179. Metadata: "demo.proto",
  180. }