Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterProductServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterProductServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductServiceClient) error
- func RegisterProductServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterProductServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductServiceServer) error
- func RegisterProductServiceServer(s grpc.ServiceRegistrar, srv ProductServiceServer)
- type AddProductRequest
- func (*AddProductRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddProductRequest) GetName() string
- func (x *AddProductRequest) GetPrice() float64
- func (*AddProductRequest) ProtoMessage()
- func (x *AddProductRequest) ProtoReflect() protoreflect.Message
- func (x *AddProductRequest) Reset()
- func (x *AddProductRequest) String() string
- type AddProductResponse
- func (*AddProductResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AddProductResponse) GetProductId() string
- func (*AddProductResponse) ProtoMessage()
- func (x *AddProductResponse) ProtoReflect() protoreflect.Message
- func (x *AddProductResponse) Reset()
- func (x *AddProductResponse) String() string
- type DeleteProductRequest
- func (*DeleteProductRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteProductRequest) GetProductId() string
- func (*DeleteProductRequest) ProtoMessage()
- func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteProductRequest) Reset()
- func (x *DeleteProductRequest) String() string
- type DeleteProductResponse
- func (*DeleteProductResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteProductResponse) GetProduct() *Product
- func (*DeleteProductResponse) ProtoMessage()
- func (x *DeleteProductResponse) ProtoReflect() protoreflect.Message
- func (x *DeleteProductResponse) Reset()
- func (x *DeleteProductResponse) String() string
- type ListProductsRequest
- type ListProductsResponse
- func (*ListProductsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListProductsResponse) GetProducts() []*Product
- func (*ListProductsResponse) ProtoMessage()
- func (x *ListProductsResponse) ProtoReflect() protoreflect.Message
- func (x *ListProductsResponse) Reset()
- func (x *ListProductsResponse) String() string
- type Product
- func (*Product) Descriptor() ([]byte, []int)deprecated
- func (x *Product) GetId() string
- func (x *Product) GetName() string
- func (x *Product) GetPrice() float64
- func (*Product) ProtoMessage()
- func (x *Product) ProtoReflect() protoreflect.Message
- func (x *Product) Reset()
- func (x *Product) String() string
- type ProductServiceClient
- type ProductServiceServer
- type UnimplementedProductServiceServer
- func (UnimplementedProductServiceServer) AddProduct(context.Context, *AddProductRequest) (*AddProductResponse, error)
- func (UnimplementedProductServiceServer) DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error)
- func (UnimplementedProductServiceServer) ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, error)
- type UnsafeProductServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_product_v1_product_proto protoreflect.FileDescriptor
var ProductService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "product.v1.ProductService", HandlerType: (*ProductServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddProduct", Handler: _ProductService_AddProduct_Handler, }, { MethodName: "DeleteProduct", Handler: _ProductService_DeleteProduct_Handler, }, { MethodName: "ListProducts", Handler: _ProductService_ListProducts_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "product/v1/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 AddProductRequest ¶
type AddProductRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Price float64 `protobuf:"fixed64,2,opt,name=price,proto3" json:"price,omitempty"` // contains filtered or unexported fields }
func (*AddProductRequest) Descriptor
deprecated
func (*AddProductRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddProductRequest.ProtoReflect.Descriptor instead.
func (*AddProductRequest) GetName ¶
func (x *AddProductRequest) GetName() string
func (*AddProductRequest) GetPrice ¶
func (x *AddProductRequest) GetPrice() float64
func (*AddProductRequest) ProtoMessage ¶
func (*AddProductRequest) ProtoMessage()
func (*AddProductRequest) ProtoReflect ¶
func (x *AddProductRequest) ProtoReflect() protoreflect.Message
func (*AddProductRequest) Reset ¶
func (x *AddProductRequest) Reset()
func (*AddProductRequest) String ¶
func (x *AddProductRequest) String() string
type AddProductResponse ¶
type AddProductResponse struct { ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` // contains filtered or unexported fields }
func (*AddProductResponse) Descriptor
deprecated
func (*AddProductResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddProductResponse.ProtoReflect.Descriptor instead.
func (*AddProductResponse) GetProductId ¶
func (x *AddProductResponse) GetProductId() string
func (*AddProductResponse) ProtoMessage ¶
func (*AddProductResponse) ProtoMessage()
func (*AddProductResponse) ProtoReflect ¶
func (x *AddProductResponse) ProtoReflect() protoreflect.Message
func (*AddProductResponse) Reset ¶
func (x *AddProductResponse) Reset()
func (*AddProductResponse) String ¶
func (x *AddProductResponse) String() string
type DeleteProductRequest ¶
type DeleteProductRequest struct { ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` // contains filtered or unexported fields }
func (*DeleteProductRequest) Descriptor
deprecated
func (*DeleteProductRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteProductRequest.ProtoReflect.Descriptor instead.
func (*DeleteProductRequest) GetProductId ¶
func (x *DeleteProductRequest) GetProductId() string
func (*DeleteProductRequest) ProtoMessage ¶
func (*DeleteProductRequest) ProtoMessage()
func (*DeleteProductRequest) ProtoReflect ¶
func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message
func (*DeleteProductRequest) Reset ¶
func (x *DeleteProductRequest) Reset()
func (*DeleteProductRequest) String ¶
func (x *DeleteProductRequest) String() string
type DeleteProductResponse ¶
type DeleteProductResponse struct { Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"` // contains filtered or unexported fields }
func (*DeleteProductResponse) Descriptor
deprecated
func (*DeleteProductResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteProductResponse.ProtoReflect.Descriptor instead.
func (*DeleteProductResponse) GetProduct ¶
func (x *DeleteProductResponse) GetProduct() *Product
func (*DeleteProductResponse) ProtoMessage ¶
func (*DeleteProductResponse) ProtoMessage()
func (*DeleteProductResponse) ProtoReflect ¶
func (x *DeleteProductResponse) ProtoReflect() protoreflect.Message
func (*DeleteProductResponse) Reset ¶
func (x *DeleteProductResponse) Reset()
func (*DeleteProductResponse) String ¶
func (x *DeleteProductResponse) String() string
type ListProductsRequest ¶
type ListProductsRequest struct {
// contains filtered or unexported fields
}
func (*ListProductsRequest) Descriptor
deprecated
func (*ListProductsRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListProductsRequest.ProtoReflect.Descriptor instead.
func (*ListProductsRequest) ProtoMessage ¶
func (*ListProductsRequest) ProtoMessage()
func (*ListProductsRequest) ProtoReflect ¶
func (x *ListProductsRequest) ProtoReflect() protoreflect.Message
func (*ListProductsRequest) Reset ¶
func (x *ListProductsRequest) Reset()
func (*ListProductsRequest) String ¶
func (x *ListProductsRequest) String() string
type ListProductsResponse ¶
type ListProductsResponse struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` // contains filtered or unexported fields }
func (*ListProductsResponse) Descriptor
deprecated
func (*ListProductsResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListProductsResponse.ProtoReflect.Descriptor instead.
func (*ListProductsResponse) GetProducts ¶
func (x *ListProductsResponse) GetProducts() []*Product
func (*ListProductsResponse) ProtoMessage ¶
func (*ListProductsResponse) ProtoMessage()
func (*ListProductsResponse) ProtoReflect ¶
func (x *ListProductsResponse) ProtoReflect() protoreflect.Message
func (*ListProductsResponse) Reset ¶
func (x *ListProductsResponse) Reset()
func (*ListProductsResponse) String ¶
func (x *ListProductsResponse) 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"` Price float64 `protobuf:"fixed64,3,opt,name=price,proto3" json:"price,omitempty"` // contains filtered or unexported fields }
func (*Product) Descriptor
deprecated
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) ProtoReflect ¶
func (x *Product) ProtoReflect() protoreflect.Message
type ProductServiceClient ¶
type ProductServiceClient interface { AddProduct(ctx context.Context, in *AddProductRequest, opts ...grpc.CallOption) (*AddProductResponse, error) DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*DeleteProductResponse, error) ListProducts(ctx context.Context, in *ListProductsRequest, opts ...grpc.CallOption) (*ListProductsResponse, 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.
func NewProductServiceClient ¶
func NewProductServiceClient(cc grpc.ClientConnInterface) ProductServiceClient
type ProductServiceServer ¶
type ProductServiceServer interface { AddProduct(context.Context, *AddProductRequest) (*AddProductResponse, error) DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error) ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, 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) AddProduct(context.Context, *AddProductRequest) (*AddProductResponse, error)
func (UnimplementedProductServiceServer) DeleteProduct ¶
func (UnimplementedProductServiceServer) DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error)
func (UnimplementedProductServiceServer) ListProducts ¶
func (UnimplementedProductServiceServer) ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, error)
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.