product

package
v0.0.0-...-f8a7b2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package product is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_protos_product_product_proto protoreflect.FileDescriptor
View Source
var ProductService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "productpb.ProductService",
	HandlerType: (*ProductServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddProduct",
			Handler:    _ProductService_AddProduct_Handler,
		},
		{
			MethodName: "GetProduct",
			Handler:    _ProductService_GetProduct_Handler,
		},
		{
			MethodName: "GetProductCatalogue",
			Handler:    _ProductService_GetProductCatalogue_Handler,
		},
		{
			MethodName: "UpdateProduct",
			Handler:    _ProductService_UpdateProduct_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "protos/product/product.proto",
}

ProductService_ServiceDesc is the grpc.ServiceDesc for ProductService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterProductServiceHandler

func RegisterProductServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterProductServiceHandler registers the http handlers for service ProductService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterProductServiceHandlerClient

func RegisterProductServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductServiceClient) error

RegisterProductServiceHandlerClient registers the http handlers for service ProductService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProductServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProductServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ProductServiceClient" to call the correct interceptors.

func RegisterProductServiceHandlerFromEndpoint

func RegisterProductServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterProductServiceHandlerFromEndpoint is same as RegisterProductServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterProductServiceHandlerServer

func RegisterProductServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductServiceServer) error

RegisterProductServiceHandlerServer registers the http handlers for service ProductService to "mux". UnaryRPC :call ProductServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterProductServiceHandlerFromEndpoint instead.

func RegisterProductServiceServer

func RegisterProductServiceServer(s grpc.ServiceRegistrar, srv ProductServiceServer)

Types

type GetProductRequest

type GetProductRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProductRequest) Descriptor deprecated

func (*GetProductRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetProductRequest.ProtoReflect.Descriptor instead.

func (*GetProductRequest) GetId

func (x *GetProductRequest) GetId() string

func (*GetProductRequest) ProtoMessage

func (*GetProductRequest) ProtoMessage()

func (*GetProductRequest) ProtoReflect

func (x *GetProductRequest) ProtoReflect() protoreflect.Message

func (*GetProductRequest) Reset

func (x *GetProductRequest) Reset()

func (*GetProductRequest) String

func (x *GetProductRequest) String() string

type GetProductResponse

type GetProductResponse struct {
	Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProductResponse) Descriptor deprecated

func (*GetProductResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetProductResponse.ProtoReflect.Descriptor instead.

func (*GetProductResponse) GetProduct

func (x *GetProductResponse) GetProduct() *Product

func (*GetProductResponse) ProtoMessage

func (*GetProductResponse) ProtoMessage()

func (*GetProductResponse) ProtoReflect

func (x *GetProductResponse) ProtoReflect() protoreflect.Message

func (*GetProductResponse) Reset

func (x *GetProductResponse) Reset()

func (*GetProductResponse) String

func (x *GetProductResponse) String() string

type Product

type Product 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"`
	Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"`
	Price    int32  `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"`
	Quantity int32  `protobuf:"varint,5,opt,name=quantity,proto3" json:"quantity,omitempty"`
	// contains filtered or unexported fields
}

func (*Product) Descriptor deprecated

func (*Product) Descriptor() ([]byte, []int)

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetCategory

func (x *Product) GetCategory() string

func (*Product) GetId

func (x *Product) GetId() string

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetPrice

func (x *Product) GetPrice() int32

func (*Product) GetQuantity

func (x *Product) GetQuantity() int32

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

func (x *Product) ProtoReflect() protoreflect.Message

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type ProductCatalogue

type ProductCatalogue struct {
	Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"`
	// contains filtered or unexported fields
}

func (*ProductCatalogue) Descriptor deprecated

func (*ProductCatalogue) Descriptor() ([]byte, []int)

Deprecated: Use ProductCatalogue.ProtoReflect.Descriptor instead.

func (*ProductCatalogue) GetProducts

func (x *ProductCatalogue) GetProducts() []*Product

func (*ProductCatalogue) ProtoMessage

func (*ProductCatalogue) ProtoMessage()

func (*ProductCatalogue) ProtoReflect

func (x *ProductCatalogue) ProtoReflect() protoreflect.Message

func (*ProductCatalogue) Reset

func (x *ProductCatalogue) Reset()

func (*ProductCatalogue) String

func (x *ProductCatalogue) String() string

type ProductServiceClient

type ProductServiceClient interface {
	AddProduct(ctx context.Context, in *Product, opts ...grpc.CallOption) (*GetProductResponse, error)
	GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*GetProductResponse, error)
	GetProductCatalogue(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ProductCatalogue, error)
	UpdateProduct(ctx context.Context, in *Product, opts ...grpc.CallOption) (*Product, error)
}

ProductServiceClient is the client API for ProductService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type ProductServiceServer

type ProductServiceServer interface {
	AddProduct(context.Context, *Product) (*GetProductResponse, error)
	GetProduct(context.Context, *GetProductRequest) (*GetProductResponse, error)
	GetProductCatalogue(context.Context, *emptypb.Empty) (*ProductCatalogue, error)
	UpdateProduct(context.Context, *Product) (*Product, error)
	// contains filtered or unexported methods
}

ProductServiceServer is the server API for ProductService service. All implementations must embed UnimplementedProductServiceServer for forward compatibility

type UnimplementedProductServiceServer

type UnimplementedProductServiceServer struct {
}

UnimplementedProductServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedProductServiceServer) AddProduct

func (UnimplementedProductServiceServer) GetProduct

func (UnimplementedProductServiceServer) GetProductCatalogue

func (UnimplementedProductServiceServer) UpdateProduct

type UnsafeProductServiceServer

type UnsafeProductServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeProductServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ProductServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL