Add user-service generated-code
This commit is contained in:
		
							
								
								
									
										276
									
								
								examples/go-kit/services/user/gen/pb/pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										276
									
								
								examples/go-kit/services/user/gen/pb/pb.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,276 @@ | ||||
| // Code generated by protoc-gen-gogo. | ||||
| // source: services/user/user.proto | ||||
| // DO NOT EDIT! | ||||
|  | ||||
| /* | ||||
| Package user is a generated protocol buffer package. | ||||
|  | ||||
| It is generated from these files: | ||||
| 	services/user/user.proto | ||||
|  | ||||
| It has these top-level messages: | ||||
| 	CreateUserRequest | ||||
| 	CreateUserResponse | ||||
| 	GetUserRequest | ||||
| 	GetUserResponse | ||||
| 	User | ||||
| */ | ||||
| package user | ||||
|  | ||||
| import proto "github.com/gogo/protobuf/proto" | ||||
| import fmt "fmt" | ||||
| import math "math" | ||||
|  | ||||
| import ( | ||||
| 	context "golang.org/x/net/context" | ||||
| 	grpc "google.golang.org/grpc" | ||||
| ) | ||||
|  | ||||
| // 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package | ||||
|  | ||||
| type CreateUserRequest struct { | ||||
| 	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` | ||||
| } | ||||
|  | ||||
| func (m *CreateUserRequest) Reset()                    { *m = CreateUserRequest{} } | ||||
| func (m *CreateUserRequest) String() string            { return proto.CompactTextString(m) } | ||||
| func (*CreateUserRequest) ProtoMessage()               {} | ||||
| func (*CreateUserRequest) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{0} } | ||||
|  | ||||
| func (m *CreateUserRequest) GetName() string { | ||||
| 	if m != nil { | ||||
| 		return m.Name | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| type CreateUserResponse struct { | ||||
| 	User   *User  `protobuf:"bytes,1,opt,name=user" json:"user,omitempty"` | ||||
| 	ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg,proto3" json:"err_msg,omitempty"` | ||||
| } | ||||
|  | ||||
| func (m *CreateUserResponse) Reset()                    { *m = CreateUserResponse{} } | ||||
| func (m *CreateUserResponse) String() string            { return proto.CompactTextString(m) } | ||||
| func (*CreateUserResponse) ProtoMessage()               {} | ||||
| func (*CreateUserResponse) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{1} } | ||||
|  | ||||
| func (m *CreateUserResponse) GetUser() *User { | ||||
| 	if m != nil { | ||||
| 		return m.User | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *CreateUserResponse) GetErrMsg() string { | ||||
| 	if m != nil { | ||||
| 		return m.ErrMsg | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| type GetUserRequest struct { | ||||
| 	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | ||||
| } | ||||
|  | ||||
| func (m *GetUserRequest) Reset()                    { *m = GetUserRequest{} } | ||||
| func (m *GetUserRequest) String() string            { return proto.CompactTextString(m) } | ||||
| func (*GetUserRequest) ProtoMessage()               {} | ||||
| func (*GetUserRequest) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{2} } | ||||
|  | ||||
| func (m *GetUserRequest) GetId() string { | ||||
| 	if m != nil { | ||||
| 		return m.Id | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| type GetUserResponse struct { | ||||
| 	User   *User  `protobuf:"bytes,1,opt,name=user" json:"user,omitempty"` | ||||
| 	ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg,proto3" json:"err_msg,omitempty"` | ||||
| } | ||||
|  | ||||
| func (m *GetUserResponse) Reset()                    { *m = GetUserResponse{} } | ||||
| func (m *GetUserResponse) String() string            { return proto.CompactTextString(m) } | ||||
| func (*GetUserResponse) ProtoMessage()               {} | ||||
| func (*GetUserResponse) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{3} } | ||||
|  | ||||
| func (m *GetUserResponse) GetUser() *User { | ||||
| 	if m != nil { | ||||
| 		return m.User | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *GetUserResponse) GetErrMsg() string { | ||||
| 	if m != nil { | ||||
| 		return m.ErrMsg | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| type User struct { | ||||
| 	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | ||||
| 	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` | ||||
| } | ||||
|  | ||||
| func (m *User) Reset()                    { *m = User{} } | ||||
| func (m *User) String() string            { return proto.CompactTextString(m) } | ||||
| func (*User) ProtoMessage()               {} | ||||
| func (*User) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{4} } | ||||
|  | ||||
| func (m *User) GetId() string { | ||||
| 	if m != nil { | ||||
| 		return m.Id | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *User) GetName() string { | ||||
| 	if m != nil { | ||||
| 		return m.Name | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	proto.RegisterType((*CreateUserRequest)(nil), "user.CreateUserRequest") | ||||
| 	proto.RegisterType((*CreateUserResponse)(nil), "user.CreateUserResponse") | ||||
| 	proto.RegisterType((*GetUserRequest)(nil), "user.GetUserRequest") | ||||
| 	proto.RegisterType((*GetUserResponse)(nil), "user.GetUserResponse") | ||||
| 	proto.RegisterType((*User)(nil), "user.User") | ||||
| } | ||||
|  | ||||
| // 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 | ||||
|  | ||||
| // Client API for UserService service | ||||
|  | ||||
| type UserServiceClient interface { | ||||
| 	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) | ||||
| 	GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) | ||||
| } | ||||
|  | ||||
| type userServiceClient struct { | ||||
| 	cc *grpc.ClientConn | ||||
| } | ||||
|  | ||||
| func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient { | ||||
| 	return &userServiceClient{cc} | ||||
| } | ||||
|  | ||||
| func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { | ||||
| 	out := new(CreateUserResponse) | ||||
| 	err := grpc.Invoke(ctx, "/user.UserService/CreateUser", in, out, c.cc, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { | ||||
| 	out := new(GetUserResponse) | ||||
| 	err := grpc.Invoke(ctx, "/user.UserService/GetUser", in, out, c.cc, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| // Server API for UserService service | ||||
|  | ||||
| type UserServiceServer interface { | ||||
| 	CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) | ||||
| 	GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) | ||||
| } | ||||
|  | ||||
| func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer) { | ||||
| 	s.RegisterService(&_UserService_serviceDesc, srv) | ||||
| } | ||||
|  | ||||
| func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||
| 	in := new(CreateUserRequest) | ||||
| 	if err := dec(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if interceptor == nil { | ||||
| 		return srv.(UserServiceServer).CreateUser(ctx, in) | ||||
| 	} | ||||
| 	info := &grpc.UnaryServerInfo{ | ||||
| 		Server:     srv, | ||||
| 		FullMethod: "/user.UserService/CreateUser", | ||||
| 	} | ||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| 		return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) | ||||
| 	} | ||||
| 	return interceptor(ctx, in, info, handler) | ||||
| } | ||||
|  | ||||
| func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||
| 	in := new(GetUserRequest) | ||||
| 	if err := dec(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if interceptor == nil { | ||||
| 		return srv.(UserServiceServer).GetUser(ctx, in) | ||||
| 	} | ||||
| 	info := &grpc.UnaryServerInfo{ | ||||
| 		Server:     srv, | ||||
| 		FullMethod: "/user.UserService/GetUser", | ||||
| 	} | ||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| 		return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest)) | ||||
| 	} | ||||
| 	return interceptor(ctx, in, info, handler) | ||||
| } | ||||
|  | ||||
| var _UserService_serviceDesc = grpc.ServiceDesc{ | ||||
| 	ServiceName: "user.UserService", | ||||
| 	HandlerType: (*UserServiceServer)(nil), | ||||
| 	Methods: []grpc.MethodDesc{ | ||||
| 		{ | ||||
| 			MethodName: "CreateUser", | ||||
| 			Handler:    _UserService_CreateUser_Handler, | ||||
| 		}, | ||||
| 		{ | ||||
| 			MethodName: "GetUser", | ||||
| 			Handler:    _UserService_GetUser_Handler, | ||||
| 		}, | ||||
| 	}, | ||||
| 	Streams:  []grpc.StreamDesc{}, | ||||
| 	Metadata: "services/user/user.proto", | ||||
| } | ||||
|  | ||||
| func init() { proto.RegisterFile("services/user/user.proto", fileDescriptorUser) } | ||||
|  | ||||
| var fileDescriptorUser = []byte{ | ||||
| 	// 236 bytes of a gzipped FileDescriptorProto | ||||
| 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x4e, 0x2d, 0x2a, | ||||
| 	0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x2f, 0x2d, 0x4e, 0x2d, 0x02, 0x13, 0x7a, 0x05, 0x45, 0xf9, 0x25, | ||||
| 	0xf9, 0x42, 0x2c, 0x20, 0xb6, 0x92, 0x3a, 0x97, 0xa0, 0x73, 0x51, 0x6a, 0x62, 0x49, 0x6a, 0x68, | ||||
| 	0x71, 0x6a, 0x51, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x90, 0x10, 0x17, 0x4b, 0x5e, 0x62, | ||||
| 	0x6e, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, 0xad, 0xe4, 0xcb, 0x25, 0x84, 0xac, | ||||
| 	0xb0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x48, 0x8e, 0x0b, 0x6c, 0x0c, 0x58, 0x25, 0xb7, 0x11, | ||||
| 	0x97, 0x1e, 0xd8, 0x7c, 0xb0, 0x0a, 0xb0, 0xb8, 0x90, 0x38, 0x17, 0x7b, 0x6a, 0x51, 0x51, 0x7c, | ||||
| 	0x6e, 0x71, 0xba, 0x04, 0x13, 0xd8, 0x30, 0xb6, 0xd4, 0xa2, 0x22, 0xdf, 0xe2, 0x74, 0x25, 0x05, | ||||
| 	0x2e, 0x3e, 0xf7, 0xd4, 0x12, 0x64, 0x4b, 0xf9, 0xb8, 0x98, 0x32, 0x53, 0xa0, 0x56, 0x32, 0x65, | ||||
| 	0xa6, 0x28, 0x79, 0x71, 0xf1, 0xc3, 0x55, 0x50, 0x6a, 0x9b, 0x16, 0x17, 0x0b, 0x48, 0x19, 0xba, | ||||
| 	0x1d, 0x70, 0x8f, 0x32, 0x21, 0x3c, 0x6a, 0xd4, 0xc5, 0xc8, 0xc5, 0x0d, 0x52, 0x1c, 0x0c, 0x09, | ||||
| 	0x38, 0x21, 0x47, 0x2e, 0x2e, 0x84, 0xc7, 0x85, 0xc4, 0x21, 0x96, 0x62, 0x84, 0x99, 0x94, 0x04, | ||||
| 	0xa6, 0x04, 0xc4, 0xd5, 0x4a, 0x0c, 0x42, 0x16, 0x5c, 0xec, 0x50, 0xaf, 0x08, 0x89, 0x40, 0x94, | ||||
| 	0xa1, 0xfa, 0x5d, 0x4a, 0x14, 0x4d, 0x14, 0xa6, 0x33, 0x89, 0x0d, 0x1c, 0x57, 0xc6, 0x80, 0x00, | ||||
| 	0x00, 0x00, 0xff, 0xff, 0xce, 0xde, 0xa3, 0x2e, 0xc7, 0x01, 0x00, 0x00, | ||||
| } | ||||
		Reference in New Issue
	
	Block a user