add.pb.go 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go v1.25.0
  4. // protoc v3.14.0
  5. // source: add.proto
  6. package add
  7. import (
  8. context "context"
  9. proto "github.com/golang/protobuf/proto"
  10. grpc "google.golang.org/grpc"
  11. codes "google.golang.org/grpc/codes"
  12. status "google.golang.org/grpc/status"
  13. protoreflect "google.golang.org/protobuf/reflect/protoreflect"
  14. protoimpl "google.golang.org/protobuf/runtime/protoimpl"
  15. reflect "reflect"
  16. sync "sync"
  17. )
  18. const (
  19. // Verify that this generated code is sufficiently up-to-date.
  20. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  21. // Verify that runtime/protoimpl is sufficiently up-to-date.
  22. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  23. )
  24. // This is a compile-time assertion that a sufficiently up-to-date version
  25. // of the legacy proto package is being used.
  26. const _ = proto.ProtoPackageIsVersion4
  27. type AddReq struct {
  28. state protoimpl.MessageState
  29. sizeCache protoimpl.SizeCache
  30. unknownFields protoimpl.UnknownFields
  31. Book string `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"`
  32. Price int64 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"`
  33. }
  34. func (x *AddReq) Reset() {
  35. *x = AddReq{}
  36. if protoimpl.UnsafeEnabled {
  37. mi := &file_add_proto_msgTypes[0]
  38. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  39. ms.StoreMessageInfo(mi)
  40. }
  41. }
  42. func (x *AddReq) String() string {
  43. return protoimpl.X.MessageStringOf(x)
  44. }
  45. func (*AddReq) ProtoMessage() {}
  46. func (x *AddReq) ProtoReflect() protoreflect.Message {
  47. mi := &file_add_proto_msgTypes[0]
  48. if protoimpl.UnsafeEnabled && x != nil {
  49. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  50. if ms.LoadMessageInfo() == nil {
  51. ms.StoreMessageInfo(mi)
  52. }
  53. return ms
  54. }
  55. return mi.MessageOf(x)
  56. }
  57. // Deprecated: Use AddReq.ProtoReflect.Descriptor instead.
  58. func (*AddReq) Descriptor() ([]byte, []int) {
  59. return file_add_proto_rawDescGZIP(), []int{0}
  60. }
  61. func (x *AddReq) GetBook() string {
  62. if x != nil {
  63. return x.Book
  64. }
  65. return ""
  66. }
  67. func (x *AddReq) GetPrice() int64 {
  68. if x != nil {
  69. return x.Price
  70. }
  71. return 0
  72. }
  73. type AddResp struct {
  74. state protoimpl.MessageState
  75. sizeCache protoimpl.SizeCache
  76. unknownFields protoimpl.UnknownFields
  77. Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
  78. }
  79. func (x *AddResp) Reset() {
  80. *x = AddResp{}
  81. if protoimpl.UnsafeEnabled {
  82. mi := &file_add_proto_msgTypes[1]
  83. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  84. ms.StoreMessageInfo(mi)
  85. }
  86. }
  87. func (x *AddResp) String() string {
  88. return protoimpl.X.MessageStringOf(x)
  89. }
  90. func (*AddResp) ProtoMessage() {}
  91. func (x *AddResp) ProtoReflect() protoreflect.Message {
  92. mi := &file_add_proto_msgTypes[1]
  93. if protoimpl.UnsafeEnabled && x != nil {
  94. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  95. if ms.LoadMessageInfo() == nil {
  96. ms.StoreMessageInfo(mi)
  97. }
  98. return ms
  99. }
  100. return mi.MessageOf(x)
  101. }
  102. // Deprecated: Use AddResp.ProtoReflect.Descriptor instead.
  103. func (*AddResp) Descriptor() ([]byte, []int) {
  104. return file_add_proto_rawDescGZIP(), []int{1}
  105. }
  106. func (x *AddResp) GetOk() bool {
  107. if x != nil {
  108. return x.Ok
  109. }
  110. return false
  111. }
  112. var File_add_proto protoreflect.FileDescriptor
  113. var file_add_proto_rawDesc = []byte{
  114. 0x0a, 0x09, 0x61, 0x64, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x61, 0x64, 0x64,
  115. 0x22, 0x32, 0x0a, 0x06, 0x61, 0x64, 0x64, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f,
  116. 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x14,
  117. 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70,
  118. 0x72, 0x69, 0x63, 0x65, 0x22, 0x19, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
  119. 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32,
  120. 0x29, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x03, 0x61, 0x64, 0x64, 0x12,
  121. 0x0b, 0x2e, 0x61, 0x64, 0x64, 0x2e, 0x61, 0x64, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x61,
  122. 0x64, 0x64, 0x2e, 0x61, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
  123. 0x6f, 0x33,
  124. }
  125. var (
  126. file_add_proto_rawDescOnce sync.Once
  127. file_add_proto_rawDescData = file_add_proto_rawDesc
  128. )
  129. func file_add_proto_rawDescGZIP() []byte {
  130. file_add_proto_rawDescOnce.Do(func() {
  131. file_add_proto_rawDescData = protoimpl.X.CompressGZIP(file_add_proto_rawDescData)
  132. })
  133. return file_add_proto_rawDescData
  134. }
  135. var file_add_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
  136. var file_add_proto_goTypes = []interface{}{
  137. (*AddReq)(nil), // 0: add.addReq
  138. (*AddResp)(nil), // 1: add.addResp
  139. }
  140. var file_add_proto_depIdxs = []int32{
  141. 0, // 0: add.adder.add:input_type -> add.addReq
  142. 1, // 1: add.adder.add:output_type -> add.addResp
  143. 1, // [1:2] is the sub-list for method output_type
  144. 0, // [0:1] is the sub-list for method input_type
  145. 0, // [0:0] is the sub-list for extension type_name
  146. 0, // [0:0] is the sub-list for extension extendee
  147. 0, // [0:0] is the sub-list for field type_name
  148. }
  149. func init() { file_add_proto_init() }
  150. func file_add_proto_init() {
  151. if File_add_proto != nil {
  152. return
  153. }
  154. if !protoimpl.UnsafeEnabled {
  155. file_add_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
  156. switch v := v.(*AddReq); i {
  157. case 0:
  158. return &v.state
  159. case 1:
  160. return &v.sizeCache
  161. case 2:
  162. return &v.unknownFields
  163. default:
  164. return nil
  165. }
  166. }
  167. file_add_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
  168. switch v := v.(*AddResp); i {
  169. case 0:
  170. return &v.state
  171. case 1:
  172. return &v.sizeCache
  173. case 2:
  174. return &v.unknownFields
  175. default:
  176. return nil
  177. }
  178. }
  179. }
  180. type x struct{}
  181. out := protoimpl.TypeBuilder{
  182. File: protoimpl.DescBuilder{
  183. GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
  184. RawDescriptor: file_add_proto_rawDesc,
  185. NumEnums: 0,
  186. NumMessages: 2,
  187. NumExtensions: 0,
  188. NumServices: 1,
  189. },
  190. GoTypes: file_add_proto_goTypes,
  191. DependencyIndexes: file_add_proto_depIdxs,
  192. MessageInfos: file_add_proto_msgTypes,
  193. }.Build()
  194. File_add_proto = out.File
  195. file_add_proto_rawDesc = nil
  196. file_add_proto_goTypes = nil
  197. file_add_proto_depIdxs = nil
  198. }
  199. // Reference imports to suppress errors if they are not otherwise used.
  200. var _ context.Context
  201. var _ grpc.ClientConnInterface
  202. // This is a compile-time assertion to ensure that this generated file
  203. // is compatible with the grpc package it is being compiled against.
  204. const _ = grpc.SupportPackageIsVersion6
  205. // AdderClient is the client API for Adder service.
  206. //
  207. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  208. type AdderClient interface {
  209. Add(ctx context.Context, in *AddReq, opts ...grpc.CallOption) (*AddResp, error)
  210. }
  211. type adderClient struct {
  212. cc grpc.ClientConnInterface
  213. }
  214. func NewAdderClient(cc grpc.ClientConnInterface) AdderClient {
  215. return &adderClient{cc}
  216. }
  217. func (c *adderClient) Add(ctx context.Context, in *AddReq, opts ...grpc.CallOption) (*AddResp, error) {
  218. out := new(AddResp)
  219. err := c.cc.Invoke(ctx, "/add.adder/add", in, out, opts...)
  220. if err != nil {
  221. return nil, err
  222. }
  223. return out, nil
  224. }
  225. // AdderServer is the server API for Adder service.
  226. type AdderServer interface {
  227. Add(context.Context, *AddReq) (*AddResp, error)
  228. }
  229. // UnimplementedAdderServer can be embedded to have forward compatible implementations.
  230. type UnimplementedAdderServer struct {
  231. }
  232. func (*UnimplementedAdderServer) Add(context.Context, *AddReq) (*AddResp, error) {
  233. return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
  234. }
  235. func RegisterAdderServer(s *grpc.Server, srv AdderServer) {
  236. s.RegisterService(&_Adder_serviceDesc, srv)
  237. }
  238. func _Adder_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  239. in := new(AddReq)
  240. if err := dec(in); err != nil {
  241. return nil, err
  242. }
  243. if interceptor == nil {
  244. return srv.(AdderServer).Add(ctx, in)
  245. }
  246. info := &grpc.UnaryServerInfo{
  247. Server: srv,
  248. FullMethod: "/add.adder/Add",
  249. }
  250. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  251. return srv.(AdderServer).Add(ctx, req.(*AddReq))
  252. }
  253. return interceptor(ctx, in, info, handler)
  254. }
  255. var _Adder_serviceDesc = grpc.ServiceDesc{
  256. ServiceName: "add.adder",
  257. HandlerType: (*AdderServer)(nil),
  258. Methods: []grpc.MethodDesc{
  259. {
  260. MethodName: "add",
  261. Handler: _Adder_Add_Handler,
  262. },
  263. },
  264. Streams: []grpc.StreamDesc{},
  265. Metadata: "add.proto",
  266. }