|
@@ -0,0 +1,331 @@
|
|
|
+// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
|
+// source: test.proto
|
|
|
+
|
|
|
+// protoc -I=${GOPATH}/src -I=. test.proto --go_out=plugins=grpc,Mbase.proto=github.com/tal-tech/go-zero/tools/goctl/rpc:./test
|
|
|
+
|
|
|
+package test
|
|
|
+
|
|
|
+import (
|
|
|
+ context "context"
|
|
|
+ fmt "fmt"
|
|
|
+ proto "github.com/golang/protobuf/proto"
|
|
|
+ rpc "github.com/tal-tech/go-zero/tools/goctl/rpc"
|
|
|
+ grpc "google.golang.org/grpc"
|
|
|
+ codes "google.golang.org/grpc/codes"
|
|
|
+ status "google.golang.org/grpc/status"
|
|
|
+ anypb "google.golang.org/protobuf/types/known/anypb"
|
|
|
+ math "math"
|
|
|
+)
|
|
|
+
|
|
|
+// Reference imports to suppress errors if they are not otherwise used.
|
|
|
+var _ = proto.Marshal
|
|
|
+var _ = fmt.Errorf
|
|
|
+var _ = math.Inf
|
|
|
+
|
|
|
+// This is a compile-time assertion to ensure that this generated file
|
|
|
+// is compatible with the proto package it is being compiled against.
|
|
|
+// A compilation error at this line likely means your copy of the
|
|
|
+// proto package needs to be updated.
|
|
|
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
+
|
|
|
+type Gender int32
|
|
|
+
|
|
|
+const (
|
|
|
+ Gender_UNKNOWN Gender = 0
|
|
|
+ Gender_MALE Gender = 1
|
|
|
+ Gender_FEMALE Gender = 2
|
|
|
+)
|
|
|
+
|
|
|
+var Gender_name = map[int32]string{
|
|
|
+ 0: "UNKNOWN",
|
|
|
+ 1: "MALE",
|
|
|
+ 2: "FEMALE",
|
|
|
+}
|
|
|
+
|
|
|
+var Gender_value = map[string]int32{
|
|
|
+ "UNKNOWN": 0,
|
|
|
+ "MALE": 1,
|
|
|
+ "FEMALE": 2,
|
|
|
+}
|
|
|
+
|
|
|
+func (x Gender) String() string {
|
|
|
+ return proto.EnumName(Gender_name, int32(x))
|
|
|
+}
|
|
|
+
|
|
|
+func (Gender) EnumDescriptor() ([]byte, []int) {
|
|
|
+ return fileDescriptor_c161fcfdc0c3ff1e, []int{0}
|
|
|
+}
|
|
|
+
|
|
|
+type Request struct {
|
|
|
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
|
|
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
|
+ XXX_unrecognized []byte `json:"-"`
|
|
|
+ XXX_sizecache int32 `json:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Request) Reset() { *m = Request{} }
|
|
|
+func (m *Request) String() string { return proto.CompactTextString(m) }
|
|
|
+func (*Request) ProtoMessage() {}
|
|
|
+func (*Request) Descriptor() ([]byte, []int) {
|
|
|
+ return fileDescriptor_c161fcfdc0c3ff1e, []int{0}
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Request) XXX_Unmarshal(b []byte) error {
|
|
|
+ return xxx_messageInfo_Request.Unmarshal(m, b)
|
|
|
+}
|
|
|
+func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
+ return xxx_messageInfo_Request.Marshal(b, m, deterministic)
|
|
|
+}
|
|
|
+func (m *Request) XXX_Merge(src proto.Message) {
|
|
|
+ xxx_messageInfo_Request.Merge(m, src)
|
|
|
+}
|
|
|
+func (m *Request) XXX_Size() int {
|
|
|
+ return xxx_messageInfo_Request.Size(m)
|
|
|
+}
|
|
|
+func (m *Request) XXX_DiscardUnknown() {
|
|
|
+ xxx_messageInfo_Request.DiscardUnknown(m)
|
|
|
+}
|
|
|
+
|
|
|
+var xxx_messageInfo_Request proto.InternalMessageInfo
|
|
|
+
|
|
|
+func (m *Request) GetName() string {
|
|
|
+ if m != nil {
|
|
|
+ return m.Name
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+}
|
|
|
+
|
|
|
+type Response struct {
|
|
|
+ Greet string `protobuf:"bytes,1,opt,name=greet,proto3" json:"greet,omitempty"`
|
|
|
+ Data *anypb.Any `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
|
|
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
|
+ XXX_unrecognized []byte `json:"-"`
|
|
|
+ XXX_sizecache int32 `json:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Response) Reset() { *m = Response{} }
|
|
|
+func (m *Response) String() string { return proto.CompactTextString(m) }
|
|
|
+func (*Response) ProtoMessage() {}
|
|
|
+func (*Response) Descriptor() ([]byte, []int) {
|
|
|
+ return fileDescriptor_c161fcfdc0c3ff1e, []int{1}
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Response) XXX_Unmarshal(b []byte) error {
|
|
|
+ return xxx_messageInfo_Response.Unmarshal(m, b)
|
|
|
+}
|
|
|
+func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
+ return xxx_messageInfo_Response.Marshal(b, m, deterministic)
|
|
|
+}
|
|
|
+func (m *Response) XXX_Merge(src proto.Message) {
|
|
|
+ xxx_messageInfo_Response.Merge(m, src)
|
|
|
+}
|
|
|
+func (m *Response) XXX_Size() int {
|
|
|
+ return xxx_messageInfo_Response.Size(m)
|
|
|
+}
|
|
|
+func (m *Response) XXX_DiscardUnknown() {
|
|
|
+ xxx_messageInfo_Response.DiscardUnknown(m)
|
|
|
+}
|
|
|
+
|
|
|
+var xxx_messageInfo_Response proto.InternalMessageInfo
|
|
|
+
|
|
|
+func (m *Response) GetGreet() string {
|
|
|
+ if m != nil {
|
|
|
+ return m.Greet
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Response) GetData() *anypb.Any {
|
|
|
+ if m != nil {
|
|
|
+ return m.Data
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+type Map struct {
|
|
|
+ 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"`
|
|
|
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
|
+ XXX_unrecognized []byte `json:"-"`
|
|
|
+ XXX_sizecache int32 `json:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Map) Reset() { *m = Map{} }
|
|
|
+func (m *Map) String() string { return proto.CompactTextString(m) }
|
|
|
+func (*Map) ProtoMessage() {}
|
|
|
+func (*Map) Descriptor() ([]byte, []int) {
|
|
|
+ return fileDescriptor_c161fcfdc0c3ff1e, []int{2}
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Map) XXX_Unmarshal(b []byte) error {
|
|
|
+ return xxx_messageInfo_Map.Unmarshal(m, b)
|
|
|
+}
|
|
|
+func (m *Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
+ return xxx_messageInfo_Map.Marshal(b, m, deterministic)
|
|
|
+}
|
|
|
+func (m *Map) XXX_Merge(src proto.Message) {
|
|
|
+ xxx_messageInfo_Map.Merge(m, src)
|
|
|
+}
|
|
|
+func (m *Map) XXX_Size() int {
|
|
|
+ return xxx_messageInfo_Map.Size(m)
|
|
|
+}
|
|
|
+func (m *Map) XXX_DiscardUnknown() {
|
|
|
+ xxx_messageInfo_Map.DiscardUnknown(m)
|
|
|
+}
|
|
|
+
|
|
|
+var xxx_messageInfo_Map proto.InternalMessageInfo
|
|
|
+
|
|
|
+func (m *Map) GetM() map[string]string {
|
|
|
+ if m != nil {
|
|
|
+ return m.M
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func init() {
|
|
|
+ proto.RegisterEnum("test.Gender", Gender_name, Gender_value)
|
|
|
+ proto.RegisterType((*Request)(nil), "test.request")
|
|
|
+ proto.RegisterType((*Response)(nil), "test.response")
|
|
|
+ proto.RegisterType((*Map)(nil), "test.map")
|
|
|
+ proto.RegisterMapType((map[string]string)(nil), "test.map.MEntry")
|
|
|
+}
|
|
|
+
|
|
|
+func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) }
|
|
|
+
|
|
|
+var fileDescriptor_c161fcfdc0c3ff1e = []byte{
|
|
|
+ // 301 bytes of a gzipped FileDescriptorProto
|
|
|
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x4f, 0x4b, 0xc3, 0x40,
|
|
|
+ 0x10, 0xc5, 0xdd, 0x36, 0xa6, 0xed, 0x14, 0x35, 0x8c, 0x3d, 0xd4, 0x80, 0x52, 0x7a, 0x90, 0xa0,
|
|
|
+ 0xb0, 0xc5, 0xea, 0x41, 0xbc, 0xf5, 0x10, 0x8b, 0x7f, 0x5a, 0x21, 0x20, 0x1e, 0x3c, 0x6d, 0xc9,
|
|
|
+ 0x58, 0xc4, 0xee, 0x26, 0x6e, 0xb6, 0x42, 0xbe, 0xbd, 0x64, 0x77, 0x73, 0x7b, 0xbf, 0xd9, 0x59,
|
|
|
+ 0xde, 0x9b, 0x07, 0x60, 0xa8, 0x32, 0xbc, 0xd4, 0x85, 0x29, 0x30, 0x68, 0x74, 0x0c, 0x1b, 0x51,
|
|
|
+ 0x91, 0x9b, 0xc4, 0x67, 0xdb, 0xa2, 0xd8, 0xee, 0x68, 0x66, 0x69, 0xb3, 0xff, 0x9a, 0x09, 0x55,
|
|
|
+ 0xbb, 0xa7, 0xe9, 0x39, 0xf4, 0x34, 0xfd, 0xee, 0xa9, 0x32, 0x88, 0x10, 0x28, 0x21, 0x69, 0xcc,
|
|
|
+ 0x26, 0x2c, 0x19, 0x64, 0x56, 0x4f, 0x9f, 0xa1, 0xaf, 0xa9, 0x2a, 0x0b, 0x55, 0x11, 0x8e, 0xe0,
|
|
|
+ 0x70, 0xab, 0x89, 0x8c, 0x5f, 0x70, 0x80, 0x09, 0x04, 0xb9, 0x30, 0x62, 0xdc, 0x99, 0xb0, 0x64,
|
|
|
+ 0x38, 0x1f, 0x71, 0x67, 0xc5, 0x5b, 0x2b, 0xbe, 0x50, 0x75, 0x66, 0x37, 0xa6, 0x9f, 0xd0, 0x95,
|
|
|
+ 0xa2, 0xc4, 0x0b, 0x60, 0x72, 0xcc, 0x26, 0xdd, 0x64, 0x38, 0x8f, 0xb8, 0x8d, 0x2d, 0x45, 0xc9,
|
|
|
+ 0x57, 0xa9, 0x32, 0xba, 0xce, 0x98, 0x8c, 0xef, 0x20, 0x74, 0x80, 0x11, 0x74, 0x7f, 0xa8, 0xf6,
|
|
|
+ 0x76, 0x8d, 0x6c, 0x22, 0xfc, 0x89, 0xdd, 0x9e, 0xac, 0xdb, 0x20, 0x73, 0xf0, 0xd0, 0xb9, 0x67,
|
|
|
+ 0x57, 0xd7, 0x10, 0x2e, 0x49, 0xe5, 0xa4, 0x71, 0x08, 0xbd, 0xf7, 0xf5, 0xcb, 0xfa, 0xed, 0x63,
|
|
|
+ 0x1d, 0x1d, 0x60, 0x1f, 0x82, 0xd5, 0xe2, 0x35, 0x8d, 0x18, 0x02, 0x84, 0x8f, 0xa9, 0xd5, 0x9d,
|
|
|
+ 0x79, 0x0e, 0xbd, 0x65, 0x13, 0x9e, 0x34, 0x5e, 0xfa, 0xa3, 0xf0, 0xc8, 0x65, 0xf1, 0x65, 0xc4,
|
|
|
+ 0xc7, 0x2d, 0xfa, 0xe3, 0x6f, 0x60, 0xf0, 0x9d, 0x67, 0xbe, 0xa9, 0x13, 0x6e, 0xcb, 0x7d, 0x6a,
|
|
|
+ 0x07, 0xf1, 0xa9, 0x1b, 0xa4, 0xb2, 0x34, 0x75, 0xe6, 0xbf, 0x6c, 0x42, 0xdb, 0xc1, 0xed, 0x7f,
|
|
|
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x7a, 0x3b, 0x55, 0x9c, 0x01, 0x00, 0x00,
|
|
|
+}
|
|
|
+
|
|
|
+// Reference imports to suppress errors if they are not otherwise used.
|
|
|
+var _ context.Context
|
|
|
+var _ grpc.ClientConn
|
|
|
+
|
|
|
+// This is a compile-time assertion to ensure that this generated file
|
|
|
+// is compatible with the grpc package it is being compiled against.
|
|
|
+const _ = grpc.SupportPackageIsVersion4
|
|
|
+
|
|
|
+// GreeterClient is the client API for Greeter service.
|
|
|
+//
|
|
|
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
|
+type GreeterClient interface {
|
|
|
+ Greet(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
|
|
+ IdRequest(ctx context.Context, in *rpc.IdRequest, opts ...grpc.CallOption) (*rpc.EmptyResponse, error)
|
|
|
+}
|
|
|
+
|
|
|
+type greeterClient struct {
|
|
|
+ cc *grpc.ClientConn
|
|
|
+}
|
|
|
+
|
|
|
+func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
|
|
|
+ return &greeterClient{cc}
|
|
|
+}
|
|
|
+
|
|
|
+func (c *greeterClient) Greet(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
|
|
|
+ out := new(Response)
|
|
|
+ err := c.cc.Invoke(ctx, "/test.Greeter/greet", in, out, opts...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return out, nil
|
|
|
+}
|
|
|
+
|
|
|
+func (c *greeterClient) IdRequest(ctx context.Context, in *rpc.IdRequest, opts ...grpc.CallOption) (*rpc.EmptyResponse, error) {
|
|
|
+ out := new(rpc.EmptyResponse)
|
|
|
+ err := c.cc.Invoke(ctx, "/test.Greeter/idRequest", in, out, opts...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return out, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GreeterServer is the server API for Greeter service.
|
|
|
+type GreeterServer interface {
|
|
|
+ Greet(context.Context, *Request) (*Response, error)
|
|
|
+ IdRequest(context.Context, *rpc.IdRequest) (*rpc.EmptyResponse, error)
|
|
|
+}
|
|
|
+
|
|
|
+// UnimplementedGreeterServer can be embedded to have forward compatible implementations.
|
|
|
+type UnimplementedGreeterServer struct {
|
|
|
+}
|
|
|
+
|
|
|
+func (*UnimplementedGreeterServer) Greet(ctx context.Context, req *Request) (*Response, error) {
|
|
|
+ return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented")
|
|
|
+}
|
|
|
+func (*UnimplementedGreeterServer) IdRequest(ctx context.Context, req *rpc.IdRequest) (*rpc.EmptyResponse, error) {
|
|
|
+ return nil, status.Errorf(codes.Unimplemented, "method IdRequest not implemented")
|
|
|
+}
|
|
|
+
|
|
|
+func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
|
|
|
+ s.RegisterService(&_Greeter_serviceDesc, srv)
|
|
|
+}
|
|
|
+
|
|
|
+func _Greeter_Greet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
|
+ in := new(Request)
|
|
|
+ if err := dec(in); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ if interceptor == nil {
|
|
|
+ return srv.(GreeterServer).Greet(ctx, in)
|
|
|
+ }
|
|
|
+ info := &grpc.UnaryServerInfo{
|
|
|
+ Server: srv,
|
|
|
+ FullMethod: "/test.Greeter/Greet",
|
|
|
+ }
|
|
|
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
|
+ return srv.(GreeterServer).Greet(ctx, req.(*Request))
|
|
|
+ }
|
|
|
+ return interceptor(ctx, in, info, handler)
|
|
|
+}
|
|
|
+
|
|
|
+func _Greeter_IdRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
|
+ in := new(rpc.IdRequest)
|
|
|
+ if err := dec(in); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ if interceptor == nil {
|
|
|
+ return srv.(GreeterServer).IdRequest(ctx, in)
|
|
|
+ }
|
|
|
+ info := &grpc.UnaryServerInfo{
|
|
|
+ Server: srv,
|
|
|
+ FullMethod: "/test.Greeter/IdRequest",
|
|
|
+ }
|
|
|
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
|
+ return srv.(GreeterServer).IdRequest(ctx, req.(*rpc.IdRequest))
|
|
|
+ }
|
|
|
+ return interceptor(ctx, in, info, handler)
|
|
|
+}
|
|
|
+
|
|
|
+var _Greeter_serviceDesc = grpc.ServiceDesc{
|
|
|
+ ServiceName: "test.Greeter",
|
|
|
+ HandlerType: (*GreeterServer)(nil),
|
|
|
+ Methods: []grpc.MethodDesc{
|
|
|
+ {
|
|
|
+ MethodName: "greet",
|
|
|
+ Handler: _Greeter_Greet_Handler,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ MethodName: "idRequest",
|
|
|
+ Handler: _Greeter_IdRequest_Handler,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ Streams: []grpc.StreamDesc{},
|
|
|
+ Metadata: "test.proto",
|
|
|
+}
|