test.pb.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: test.proto
  3. // protoc -I=${GOPATH}/src -I=. test.proto --go_out=plugins=grpc,Mbase.proto=github.com/tal-tech/go-zero/tools/goctl/rpc:./test
  4. package test
  5. import (
  6. context "context"
  7. fmt "fmt"
  8. proto "github.com/golang/protobuf/proto"
  9. rpc "github.com/tal-tech/go-zero/tools/goctl/rpc"
  10. grpc "google.golang.org/grpc"
  11. codes "google.golang.org/grpc/codes"
  12. status "google.golang.org/grpc/status"
  13. anypb "google.golang.org/protobuf/types/known/anypb"
  14. math "math"
  15. )
  16. // Reference imports to suppress errors if they are not otherwise used.
  17. var _ = proto.Marshal
  18. var _ = fmt.Errorf
  19. var _ = math.Inf
  20. // This is a compile-time assertion to ensure that this generated file
  21. // is compatible with the proto package it is being compiled against.
  22. // A compilation error at this line likely means your copy of the
  23. // proto package needs to be updated.
  24. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
  25. type Gender int32
  26. const (
  27. Gender_UNKNOWN Gender = 0
  28. Gender_MALE Gender = 1
  29. Gender_FEMALE Gender = 2
  30. )
  31. var Gender_name = map[int32]string{
  32. 0: "UNKNOWN",
  33. 1: "MALE",
  34. 2: "FEMALE",
  35. }
  36. var Gender_value = map[string]int32{
  37. "UNKNOWN": 0,
  38. "MALE": 1,
  39. "FEMALE": 2,
  40. }
  41. func (x Gender) String() string {
  42. return proto.EnumName(Gender_name, int32(x))
  43. }
  44. func (Gender) EnumDescriptor() ([]byte, []int) {
  45. return fileDescriptor_c161fcfdc0c3ff1e, []int{0}
  46. }
  47. type Request struct {
  48. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  49. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  50. XXX_unrecognized []byte `json:"-"`
  51. XXX_sizecache int32 `json:"-"`
  52. }
  53. func (m *Request) Reset() { *m = Request{} }
  54. func (m *Request) String() string { return proto.CompactTextString(m) }
  55. func (*Request) ProtoMessage() {}
  56. func (*Request) Descriptor() ([]byte, []int) {
  57. return fileDescriptor_c161fcfdc0c3ff1e, []int{0}
  58. }
  59. func (m *Request) XXX_Unmarshal(b []byte) error {
  60. return xxx_messageInfo_Request.Unmarshal(m, b)
  61. }
  62. func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  63. return xxx_messageInfo_Request.Marshal(b, m, deterministic)
  64. }
  65. func (m *Request) XXX_Merge(src proto.Message) {
  66. xxx_messageInfo_Request.Merge(m, src)
  67. }
  68. func (m *Request) XXX_Size() int {
  69. return xxx_messageInfo_Request.Size(m)
  70. }
  71. func (m *Request) XXX_DiscardUnknown() {
  72. xxx_messageInfo_Request.DiscardUnknown(m)
  73. }
  74. var xxx_messageInfo_Request proto.InternalMessageInfo
  75. func (m *Request) GetName() string {
  76. if m != nil {
  77. return m.Name
  78. }
  79. return ""
  80. }
  81. type Response struct {
  82. Greet string `protobuf:"bytes,1,opt,name=greet,proto3" json:"greet,omitempty"`
  83. Data *anypb.Any `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
  84. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  85. XXX_unrecognized []byte `json:"-"`
  86. XXX_sizecache int32 `json:"-"`
  87. }
  88. func (m *Response) Reset() { *m = Response{} }
  89. func (m *Response) String() string { return proto.CompactTextString(m) }
  90. func (*Response) ProtoMessage() {}
  91. func (*Response) Descriptor() ([]byte, []int) {
  92. return fileDescriptor_c161fcfdc0c3ff1e, []int{1}
  93. }
  94. func (m *Response) XXX_Unmarshal(b []byte) error {
  95. return xxx_messageInfo_Response.Unmarshal(m, b)
  96. }
  97. func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  98. return xxx_messageInfo_Response.Marshal(b, m, deterministic)
  99. }
  100. func (m *Response) XXX_Merge(src proto.Message) {
  101. xxx_messageInfo_Response.Merge(m, src)
  102. }
  103. func (m *Response) XXX_Size() int {
  104. return xxx_messageInfo_Response.Size(m)
  105. }
  106. func (m *Response) XXX_DiscardUnknown() {
  107. xxx_messageInfo_Response.DiscardUnknown(m)
  108. }
  109. var xxx_messageInfo_Response proto.InternalMessageInfo
  110. func (m *Response) GetGreet() string {
  111. if m != nil {
  112. return m.Greet
  113. }
  114. return ""
  115. }
  116. func (m *Response) GetData() *anypb.Any {
  117. if m != nil {
  118. return m.Data
  119. }
  120. return nil
  121. }
  122. type Map struct {
  123. M map[string]string `protobuf:"bytes,1,rep,name=m,proto3" json:"m,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
  124. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  125. XXX_unrecognized []byte `json:"-"`
  126. XXX_sizecache int32 `json:"-"`
  127. }
  128. func (m *Map) Reset() { *m = Map{} }
  129. func (m *Map) String() string { return proto.CompactTextString(m) }
  130. func (*Map) ProtoMessage() {}
  131. func (*Map) Descriptor() ([]byte, []int) {
  132. return fileDescriptor_c161fcfdc0c3ff1e, []int{2}
  133. }
  134. func (m *Map) XXX_Unmarshal(b []byte) error {
  135. return xxx_messageInfo_Map.Unmarshal(m, b)
  136. }
  137. func (m *Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  138. return xxx_messageInfo_Map.Marshal(b, m, deterministic)
  139. }
  140. func (m *Map) XXX_Merge(src proto.Message) {
  141. xxx_messageInfo_Map.Merge(m, src)
  142. }
  143. func (m *Map) XXX_Size() int {
  144. return xxx_messageInfo_Map.Size(m)
  145. }
  146. func (m *Map) XXX_DiscardUnknown() {
  147. xxx_messageInfo_Map.DiscardUnknown(m)
  148. }
  149. var xxx_messageInfo_Map proto.InternalMessageInfo
  150. func (m *Map) GetM() map[string]string {
  151. if m != nil {
  152. return m.M
  153. }
  154. return nil
  155. }
  156. func init() {
  157. proto.RegisterEnum("test.Gender", Gender_name, Gender_value)
  158. proto.RegisterType((*Request)(nil), "test.request")
  159. proto.RegisterType((*Response)(nil), "test.response")
  160. proto.RegisterType((*Map)(nil), "test.map")
  161. proto.RegisterMapType((map[string]string)(nil), "test.map.MEntry")
  162. }
  163. func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) }
  164. var fileDescriptor_c161fcfdc0c3ff1e = []byte{
  165. // 301 bytes of a gzipped FileDescriptorProto
  166. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x4f, 0x4b, 0xc3, 0x40,
  167. 0x10, 0xc5, 0xdd, 0x36, 0xa6, 0xed, 0x14, 0x35, 0x8c, 0x3d, 0xd4, 0x80, 0x52, 0x7a, 0x90, 0xa0,
  168. 0xb0, 0xc5, 0xea, 0x41, 0xbc, 0xf5, 0x10, 0x8b, 0x7f, 0x5a, 0x21, 0x20, 0x1e, 0x3c, 0x6d, 0xc9,
  169. 0x58, 0xc4, 0xee, 0x26, 0x6e, 0xb6, 0x42, 0xbe, 0xbd, 0x64, 0x77, 0x73, 0x7b, 0xbf, 0xd9, 0x59,
  170. 0xde, 0x9b, 0x07, 0x60, 0xa8, 0x32, 0xbc, 0xd4, 0x85, 0x29, 0x30, 0x68, 0x74, 0x0c, 0x1b, 0x51,
  171. 0x91, 0x9b, 0xc4, 0x67, 0xdb, 0xa2, 0xd8, 0xee, 0x68, 0x66, 0x69, 0xb3, 0xff, 0x9a, 0x09, 0x55,
  172. 0xbb, 0xa7, 0xe9, 0x39, 0xf4, 0x34, 0xfd, 0xee, 0xa9, 0x32, 0x88, 0x10, 0x28, 0x21, 0x69, 0xcc,
  173. 0x26, 0x2c, 0x19, 0x64, 0x56, 0x4f, 0x9f, 0xa1, 0xaf, 0xa9, 0x2a, 0x0b, 0x55, 0x11, 0x8e, 0xe0,
  174. 0x70, 0xab, 0x89, 0x8c, 0x5f, 0x70, 0x80, 0x09, 0x04, 0xb9, 0x30, 0x62, 0xdc, 0x99, 0xb0, 0x64,
  175. 0x38, 0x1f, 0x71, 0x67, 0xc5, 0x5b, 0x2b, 0xbe, 0x50, 0x75, 0x66, 0x37, 0xa6, 0x9f, 0xd0, 0x95,
  176. 0xa2, 0xc4, 0x0b, 0x60, 0x72, 0xcc, 0x26, 0xdd, 0x64, 0x38, 0x8f, 0xb8, 0x8d, 0x2d, 0x45, 0xc9,
  177. 0x57, 0xa9, 0x32, 0xba, 0xce, 0x98, 0x8c, 0xef, 0x20, 0x74, 0x80, 0x11, 0x74, 0x7f, 0xa8, 0xf6,
  178. 0x76, 0x8d, 0x6c, 0x22, 0xfc, 0x89, 0xdd, 0x9e, 0xac, 0xdb, 0x20, 0x73, 0xf0, 0xd0, 0xb9, 0x67,
  179. 0x57, 0xd7, 0x10, 0x2e, 0x49, 0xe5, 0xa4, 0x71, 0x08, 0xbd, 0xf7, 0xf5, 0xcb, 0xfa, 0xed, 0x63,
  180. 0x1d, 0x1d, 0x60, 0x1f, 0x82, 0xd5, 0xe2, 0x35, 0x8d, 0x18, 0x02, 0x84, 0x8f, 0xa9, 0xd5, 0x9d,
  181. 0x79, 0x0e, 0xbd, 0x65, 0x13, 0x9e, 0x34, 0x5e, 0xfa, 0xa3, 0xf0, 0xc8, 0x65, 0xf1, 0x65, 0xc4,
  182. 0xc7, 0x2d, 0xfa, 0xe3, 0x6f, 0x60, 0xf0, 0x9d, 0x67, 0xbe, 0xa9, 0x13, 0x6e, 0xcb, 0x7d, 0x6a,
  183. 0x07, 0xf1, 0xa9, 0x1b, 0xa4, 0xb2, 0x34, 0x75, 0xe6, 0xbf, 0x6c, 0x42, 0xdb, 0xc1, 0xed, 0x7f,
  184. 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x7a, 0x3b, 0x55, 0x9c, 0x01, 0x00, 0x00,
  185. }
  186. // Reference imports to suppress errors if they are not otherwise used.
  187. var _ context.Context
  188. var _ grpc.ClientConn
  189. // This is a compile-time assertion to ensure that this generated file
  190. // is compatible with the grpc package it is being compiled against.
  191. const _ = grpc.SupportPackageIsVersion4
  192. // GreeterClient is the client API for Greeter service.
  193. //
  194. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  195. type GreeterClient interface {
  196. Greet(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
  197. IdRequest(ctx context.Context, in *rpc.IdRequest, opts ...grpc.CallOption) (*rpc.EmptyResponse, error)
  198. }
  199. type greeterClient struct {
  200. cc *grpc.ClientConn
  201. }
  202. func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
  203. return &greeterClient{cc}
  204. }
  205. func (c *greeterClient) Greet(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
  206. out := new(Response)
  207. err := c.cc.Invoke(ctx, "/test.Greeter/greet", in, out, opts...)
  208. if err != nil {
  209. return nil, err
  210. }
  211. return out, nil
  212. }
  213. func (c *greeterClient) IdRequest(ctx context.Context, in *rpc.IdRequest, opts ...grpc.CallOption) (*rpc.EmptyResponse, error) {
  214. out := new(rpc.EmptyResponse)
  215. err := c.cc.Invoke(ctx, "/test.Greeter/idRequest", in, out, opts...)
  216. if err != nil {
  217. return nil, err
  218. }
  219. return out, nil
  220. }
  221. // GreeterServer is the server API for Greeter service.
  222. type GreeterServer interface {
  223. Greet(context.Context, *Request) (*Response, error)
  224. IdRequest(context.Context, *rpc.IdRequest) (*rpc.EmptyResponse, error)
  225. }
  226. // UnimplementedGreeterServer can be embedded to have forward compatible implementations.
  227. type UnimplementedGreeterServer struct {
  228. }
  229. func (*UnimplementedGreeterServer) Greet(ctx context.Context, req *Request) (*Response, error) {
  230. return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented")
  231. }
  232. func (*UnimplementedGreeterServer) IdRequest(ctx context.Context, req *rpc.IdRequest) (*rpc.EmptyResponse, error) {
  233. return nil, status.Errorf(codes.Unimplemented, "method IdRequest not implemented")
  234. }
  235. func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
  236. s.RegisterService(&_Greeter_serviceDesc, srv)
  237. }
  238. func _Greeter_Greet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  239. in := new(Request)
  240. if err := dec(in); err != nil {
  241. return nil, err
  242. }
  243. if interceptor == nil {
  244. return srv.(GreeterServer).Greet(ctx, in)
  245. }
  246. info := &grpc.UnaryServerInfo{
  247. Server: srv,
  248. FullMethod: "/test.Greeter/Greet",
  249. }
  250. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  251. return srv.(GreeterServer).Greet(ctx, req.(*Request))
  252. }
  253. return interceptor(ctx, in, info, handler)
  254. }
  255. func _Greeter_IdRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  256. in := new(rpc.IdRequest)
  257. if err := dec(in); err != nil {
  258. return nil, err
  259. }
  260. if interceptor == nil {
  261. return srv.(GreeterServer).IdRequest(ctx, in)
  262. }
  263. info := &grpc.UnaryServerInfo{
  264. Server: srv,
  265. FullMethod: "/test.Greeter/IdRequest",
  266. }
  267. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  268. return srv.(GreeterServer).IdRequest(ctx, req.(*rpc.IdRequest))
  269. }
  270. return interceptor(ctx, in, info, handler)
  271. }
  272. var _Greeter_serviceDesc = grpc.ServiceDesc{
  273. ServiceName: "test.Greeter",
  274. HandlerType: (*GreeterServer)(nil),
  275. Methods: []grpc.MethodDesc{
  276. {
  277. MethodName: "greet",
  278. Handler: _Greeter_Greet_Handler,
  279. },
  280. {
  281. MethodName: "idRequest",
  282. Handler: _Greeter_IdRequest_Handler,
  283. },
  284. },
  285. Streams: []grpc.StreamDesc{},
  286. Metadata: "test.proto",
  287. }