Documentation ¶
Overview ¶
Package product_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- 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 Product
- func (*Product) Descriptor() ([]byte, []int)deprecated
- func (x *Product) GetCreatedAt() int64
- func (x *Product) GetDescription() string
- func (x *Product) GetId() string
- func (x *Product) GetName() string
- func (x *Product) GetPrice() float32
- func (x *Product) GetUpdatedAt() int64
- 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) ProcessOrderCreatedEvent(context.Context, *v11.OrderCreatedEvent) (*emptypb.Empty, error)
- func (UnimplementedProductServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
- func (UnimplementedProductServiceServer) ViewProduct(context.Context, *ViewProductRequest) (*ViewProductResponse, error)
- func (UnimplementedProductServiceServer) ViewProducts(context.Context, *ViewProductsRequest) (*ViewProductsResponse, error)
- type UnsafeProductServiceServer
- type ViewProductRequest
- type ViewProductResponse
- func (*ViewProductResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ViewProductResponse) GetProduct() *Product
- func (*ViewProductResponse) ProtoMessage()
- func (x *ViewProductResponse) ProtoReflect() protoreflect.Message
- func (x *ViewProductResponse) Reset()
- func (x *ViewProductResponse) String() string
- type ViewProductsRequest
- type ViewProductsResponse
- func (*ViewProductsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ViewProductsResponse) GetProducts() []*Product
- func (*ViewProductsResponse) ProtoMessage()
- func (x *ViewProductsResponse) ProtoReflect() protoreflect.Message
- func (x *ViewProductsResponse) Reset()
- func (x *ViewProductsResponse) String() string
Constants ¶
const ( ProductService_ServiceInfo_FullMethodName = "/stocklet.product.v1.ProductService/ServiceInfo" ProductService_ViewProduct_FullMethodName = "/stocklet.product.v1.ProductService/ViewProduct" ProductService_ViewProducts_FullMethodName = "/stocklet.product.v1.ProductService/ViewProducts" ProductService_ProcessOrderCreatedEvent_FullMethodName = "/stocklet.product.v1.ProductService/ProcessOrderCreatedEvent" )
Variables ¶
var File_stocklet_product_v1_service_proto protoreflect.FileDescriptor
var File_stocklet_product_v1_types_proto protoreflect.FileDescriptor
var ProductService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "stocklet.product.v1.ProductService", HandlerType: (*ProductServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ServiceInfo", Handler: _ProductService_ServiceInfo_Handler, }, { MethodName: "ViewProduct", Handler: _ProductService_ViewProduct_Handler, }, { MethodName: "ViewProducts", Handler: _ProductService_ViewProducts_Handler, }, { MethodName: "ProcessOrderCreatedEvent", Handler: _ProductService_ProcessOrderCreatedEvent_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "stocklet/product/v1/service.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 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"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Price float32 `protobuf:"fixed32,4,opt,name=price,proto3" json:"price,omitempty"` CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt *int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3,oneof" json:"updated_at,omitempty"` // contains filtered or unexported fields }
func (*Product) Descriptor
deprecated
func (*Product) GetCreatedAt ¶
func (*Product) GetDescription ¶
func (*Product) GetUpdatedAt ¶
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) ProtoReflect ¶
func (x *Product) ProtoReflect() protoreflect.Message
type ProductServiceClient ¶
type ProductServiceClient interface { // View information about the service. // // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) ViewProduct(ctx context.Context, in *ViewProductRequest, opts ...grpc.CallOption) (*ViewProductResponse, error) ViewProducts(ctx context.Context, in *ViewProductsRequest, opts ...grpc.CallOption) (*ViewProductsResponse, error) // A consumer will call this method to process events. // // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE // buf:lint:ignore RPC_REQUEST_STANDARD_NAME // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME ProcessOrderCreatedEvent(ctx context.Context, in *v11.OrderCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, 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 { // View information about the service. // // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) ViewProduct(context.Context, *ViewProductRequest) (*ViewProductResponse, error) ViewProducts(context.Context, *ViewProductsRequest) (*ViewProductsResponse, error) // A consumer will call this method to process events. // // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE // buf:lint:ignore RPC_REQUEST_STANDARD_NAME // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME ProcessOrderCreatedEvent(context.Context, *v11.OrderCreatedEvent) (*emptypb.Empty, 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) ProcessOrderCreatedEvent ¶
func (UnimplementedProductServiceServer) ProcessOrderCreatedEvent(context.Context, *v11.OrderCreatedEvent) (*emptypb.Empty, error)
func (UnimplementedProductServiceServer) ServiceInfo ¶
func (UnimplementedProductServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
func (UnimplementedProductServiceServer) ViewProduct ¶
func (UnimplementedProductServiceServer) ViewProduct(context.Context, *ViewProductRequest) (*ViewProductResponse, error)
func (UnimplementedProductServiceServer) ViewProducts ¶
func (UnimplementedProductServiceServer) ViewProducts(context.Context, *ViewProductsRequest) (*ViewProductsResponse, 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.
type ViewProductRequest ¶
type ViewProductRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*ViewProductRequest) Descriptor
deprecated
func (*ViewProductRequest) Descriptor() ([]byte, []int)
Deprecated: Use ViewProductRequest.ProtoReflect.Descriptor instead.
func (*ViewProductRequest) GetId ¶
func (x *ViewProductRequest) GetId() string
func (*ViewProductRequest) ProtoMessage ¶
func (*ViewProductRequest) ProtoMessage()
func (*ViewProductRequest) ProtoReflect ¶
func (x *ViewProductRequest) ProtoReflect() protoreflect.Message
func (*ViewProductRequest) Reset ¶
func (x *ViewProductRequest) Reset()
func (*ViewProductRequest) String ¶
func (x *ViewProductRequest) String() string
type ViewProductResponse ¶
type ViewProductResponse struct { Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"` // contains filtered or unexported fields }
func (*ViewProductResponse) Descriptor
deprecated
func (*ViewProductResponse) Descriptor() ([]byte, []int)
Deprecated: Use ViewProductResponse.ProtoReflect.Descriptor instead.
func (*ViewProductResponse) GetProduct ¶
func (x *ViewProductResponse) GetProduct() *Product
func (*ViewProductResponse) ProtoMessage ¶
func (*ViewProductResponse) ProtoMessage()
func (*ViewProductResponse) ProtoReflect ¶
func (x *ViewProductResponse) ProtoReflect() protoreflect.Message
func (*ViewProductResponse) Reset ¶
func (x *ViewProductResponse) Reset()
func (*ViewProductResponse) String ¶
func (x *ViewProductResponse) String() string
type ViewProductsRequest ¶
type ViewProductsRequest struct {
// contains filtered or unexported fields
}
func (*ViewProductsRequest) Descriptor
deprecated
func (*ViewProductsRequest) Descriptor() ([]byte, []int)
Deprecated: Use ViewProductsRequest.ProtoReflect.Descriptor instead.
func (*ViewProductsRequest) ProtoMessage ¶
func (*ViewProductsRequest) ProtoMessage()
func (*ViewProductsRequest) ProtoReflect ¶
func (x *ViewProductsRequest) ProtoReflect() protoreflect.Message
func (*ViewProductsRequest) Reset ¶
func (x *ViewProductsRequest) Reset()
func (*ViewProductsRequest) String ¶
func (x *ViewProductsRequest) String() string
type ViewProductsResponse ¶
type ViewProductsResponse struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` // contains filtered or unexported fields }
func (*ViewProductsResponse) Descriptor
deprecated
func (*ViewProductsResponse) Descriptor() ([]byte, []int)
Deprecated: Use ViewProductsResponse.ProtoReflect.Descriptor instead.
func (*ViewProductsResponse) GetProducts ¶
func (x *ViewProductsResponse) GetProducts() []*Product
func (*ViewProductsResponse) ProtoMessage ¶
func (*ViewProductsResponse) ProtoMessage()
func (*ViewProductsResponse) ProtoReflect ¶
func (x *ViewProductsResponse) ProtoReflect() protoreflect.Message
func (*ViewProductsResponse) Reset ¶
func (x *ViewProductsResponse) Reset()
func (*ViewProductsResponse) String ¶
func (x *ViewProductsResponse) String() string