feat: ozon products recreator, small refactor
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -19,8 +19,11 @@ import (
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion9
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	ProductsService_GetListOfProducts_FullMethodName = "/ozon.products.ProductsService/GetListOfProducts"
 | 
			
		||||
	ProductsService_GetProductPrice_FullMethodName   = "/ozon.products.ProductsService/GetProductPrice"
 | 
			
		||||
	ProductsService_GetListOfProducts_FullMethodName      = "/ozon.products.ProductsService/GetListOfProducts"
 | 
			
		||||
	ProductsService_GetProductPrice_FullMethodName        = "/ozon.products.ProductsService/GetProductPrice"
 | 
			
		||||
	ProductsService_GetProductAttributes_FullMethodName   = "/ozon.products.ProductsService/GetProductAttributes"
 | 
			
		||||
	ProductsService_DeleteProducts_FullMethodName         = "/ozon.products.ProductsService/DeleteProducts"
 | 
			
		||||
	ProductsService_CreateOrUpdateProducts_FullMethodName = "/ozon.products.ProductsService/CreateOrUpdateProducts"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ProductsServiceClient is the client API for ProductsService service.
 | 
			
		||||
@@ -30,6 +33,9 @@ type ProductsServiceClient interface {
 | 
			
		||||
	// Retrieves a list of products based on the provided request.
 | 
			
		||||
	GetListOfProducts(ctx context.Context, in *GetListOfProductsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetListOfProductsResponse], error)
 | 
			
		||||
	GetProductPrice(ctx context.Context, in *GetProductPriceRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetProductPriceResponse], error)
 | 
			
		||||
	GetProductAttributes(ctx context.Context, in *GetProductAttributesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetProductAttributesResponse], error)
 | 
			
		||||
	DeleteProducts(ctx context.Context, in *DeleteProductsRequest, opts ...grpc.CallOption) (*DeleteProductsResponse, error)
 | 
			
		||||
	CreateOrUpdateProducts(ctx context.Context, in *CreateOrUpdateProductsRequest, opts ...grpc.CallOption) (*CreateOrUpdateProductsResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type productsServiceClient struct {
 | 
			
		||||
@@ -78,6 +84,45 @@ func (c *productsServiceClient) GetProductPrice(ctx context.Context, in *GetProd
 | 
			
		||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
 | 
			
		||||
type ProductsService_GetProductPriceClient = grpc.ServerStreamingClient[GetProductPriceResponse]
 | 
			
		||||
 | 
			
		||||
func (c *productsServiceClient) GetProductAttributes(ctx context.Context, in *GetProductAttributesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetProductAttributesResponse], error) {
 | 
			
		||||
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
 | 
			
		||||
	stream, err := c.cc.NewStream(ctx, &ProductsService_ServiceDesc.Streams[2], ProductsService_GetProductAttributes_FullMethodName, cOpts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	x := &grpc.GenericClientStream[GetProductAttributesRequest, GetProductAttributesResponse]{ClientStream: stream}
 | 
			
		||||
	if err := x.ClientStream.SendMsg(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if err := x.ClientStream.CloseSend(); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return x, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
 | 
			
		||||
type ProductsService_GetProductAttributesClient = grpc.ServerStreamingClient[GetProductAttributesResponse]
 | 
			
		||||
 | 
			
		||||
func (c *productsServiceClient) DeleteProducts(ctx context.Context, in *DeleteProductsRequest, opts ...grpc.CallOption) (*DeleteProductsResponse, error) {
 | 
			
		||||
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
 | 
			
		||||
	out := new(DeleteProductsResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, ProductsService_DeleteProducts_FullMethodName, in, out, cOpts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *productsServiceClient) CreateOrUpdateProducts(ctx context.Context, in *CreateOrUpdateProductsRequest, opts ...grpc.CallOption) (*CreateOrUpdateProductsResponse, error) {
 | 
			
		||||
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
 | 
			
		||||
	out := new(CreateOrUpdateProductsResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, ProductsService_CreateOrUpdateProducts_FullMethodName, in, out, cOpts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductsServiceServer is the server API for ProductsService service.
 | 
			
		||||
// All implementations must embed UnimplementedProductsServiceServer
 | 
			
		||||
// for forward compatibility.
 | 
			
		||||
@@ -85,6 +130,9 @@ type ProductsServiceServer interface {
 | 
			
		||||
	// Retrieves a list of products based on the provided request.
 | 
			
		||||
	GetListOfProducts(*GetListOfProductsRequest, grpc.ServerStreamingServer[GetListOfProductsResponse]) error
 | 
			
		||||
	GetProductPrice(*GetProductPriceRequest, grpc.ServerStreamingServer[GetProductPriceResponse]) error
 | 
			
		||||
	GetProductAttributes(*GetProductAttributesRequest, grpc.ServerStreamingServer[GetProductAttributesResponse]) error
 | 
			
		||||
	DeleteProducts(context.Context, *DeleteProductsRequest) (*DeleteProductsResponse, error)
 | 
			
		||||
	CreateOrUpdateProducts(context.Context, *CreateOrUpdateProductsRequest) (*CreateOrUpdateProductsResponse, error)
 | 
			
		||||
	mustEmbedUnimplementedProductsServiceServer()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -101,6 +149,15 @@ func (UnimplementedProductsServiceServer) GetListOfProducts(*GetListOfProductsRe
 | 
			
		||||
func (UnimplementedProductsServiceServer) GetProductPrice(*GetProductPriceRequest, grpc.ServerStreamingServer[GetProductPriceResponse]) error {
 | 
			
		||||
	return status.Errorf(codes.Unimplemented, "method GetProductPrice not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (UnimplementedProductsServiceServer) GetProductAttributes(*GetProductAttributesRequest, grpc.ServerStreamingServer[GetProductAttributesResponse]) error {
 | 
			
		||||
	return status.Errorf(codes.Unimplemented, "method GetProductAttributes not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (UnimplementedProductsServiceServer) DeleteProducts(context.Context, *DeleteProductsRequest) (*DeleteProductsResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method DeleteProducts not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (UnimplementedProductsServiceServer) CreateOrUpdateProducts(context.Context, *CreateOrUpdateProductsRequest) (*CreateOrUpdateProductsResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method CreateOrUpdateProducts not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (UnimplementedProductsServiceServer) mustEmbedUnimplementedProductsServiceServer() {}
 | 
			
		||||
func (UnimplementedProductsServiceServer) testEmbeddedByValue()                         {}
 | 
			
		||||
 | 
			
		||||
@@ -144,13 +201,69 @@ func _ProductsService_GetProductPrice_Handler(srv interface{}, stream grpc.Serve
 | 
			
		||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
 | 
			
		||||
type ProductsService_GetProductPriceServer = grpc.ServerStreamingServer[GetProductPriceResponse]
 | 
			
		||||
 | 
			
		||||
func _ProductsService_GetProductAttributes_Handler(srv interface{}, stream grpc.ServerStream) error {
 | 
			
		||||
	m := new(GetProductAttributesRequest)
 | 
			
		||||
	if err := stream.RecvMsg(m); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return srv.(ProductsServiceServer).GetProductAttributes(m, &grpc.GenericServerStream[GetProductAttributesRequest, GetProductAttributesResponse]{ServerStream: stream})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
 | 
			
		||||
type ProductsService_GetProductAttributesServer = grpc.ServerStreamingServer[GetProductAttributesResponse]
 | 
			
		||||
 | 
			
		||||
func _ProductsService_DeleteProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(DeleteProductsRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ProductsServiceServer).DeleteProducts(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: ProductsService_DeleteProducts_FullMethodName,
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ProductsServiceServer).DeleteProducts(ctx, req.(*DeleteProductsRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _ProductsService_CreateOrUpdateProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(CreateOrUpdateProductsRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ProductsServiceServer).CreateOrUpdateProducts(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: ProductsService_CreateOrUpdateProducts_FullMethodName,
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ProductsServiceServer).CreateOrUpdateProducts(ctx, req.(*CreateOrUpdateProductsRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductsService_ServiceDesc is the grpc.ServiceDesc for ProductsService service.
 | 
			
		||||
// It's only intended for direct use with grpc.RegisterService,
 | 
			
		||||
// and not to be introspected or modified (even as a copy)
 | 
			
		||||
var ProductsService_ServiceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "ozon.products.ProductsService",
 | 
			
		||||
	HandlerType: (*ProductsServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Methods: []grpc.MethodDesc{
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "DeleteProducts",
 | 
			
		||||
			Handler:    _ProductsService_DeleteProducts_Handler,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "CreateOrUpdateProducts",
 | 
			
		||||
			Handler:    _ProductsService_CreateOrUpdateProducts_Handler,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	Streams: []grpc.StreamDesc{
 | 
			
		||||
		{
 | 
			
		||||
			StreamName:    "GetListOfProducts",
 | 
			
		||||
@@ -162,6 +275,11 @@ var ProductsService_ServiceDesc = grpc.ServiceDesc{
 | 
			
		||||
			Handler:       _ProductsService_GetProductPrice_Handler,
 | 
			
		||||
			ServerStreams: true,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			StreamName:    "GetProductAttributes",
 | 
			
		||||
			Handler:       _ProductsService_GetProductAttributes_Handler,
 | 
			
		||||
			ServerStreams: true,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	Metadata: "ozon/products.proto",
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user