Documentation ¶
Overview ¶
Package inventory is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterProductsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterProductsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductsServiceClient) error
- func RegisterProductsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterProductsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductsServiceServer) error
- func RegisterProductsServiceServer(s *grpc.Server, srv ProductsServiceServer)
- type Product
- func (*Product) Descriptor() ([]byte, []int)deprecated
- func (x *Product) GetAvailableQty() int32
- 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 Products
- type ProductsServiceClient
- type ProductsServiceServer
- type UnimplementedProductsServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_demo_inventory_product_proto protoreflect.FileDescriptor
var File_demo_inventory_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterProductsServiceHandler ¶
func RegisterProductsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterProductsServiceHandler registers the http handlers for service ProductsService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterProductsServiceHandlerClient ¶
func RegisterProductsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductsServiceClient) error
RegisterProductsServiceHandlerClient registers the http handlers for service ProductsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProductsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProductsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ProductsServiceClient" to call the correct interceptors.
func RegisterProductsServiceHandlerFromEndpoint ¶
func RegisterProductsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterProductsServiceHandlerFromEndpoint is same as RegisterProductsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterProductsServiceHandlerServer ¶
func RegisterProductsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductsServiceServer) error
RegisterProductsServiceHandlerServer registers the http handlers for service ProductsService to "mux". UnaryRPC :call ProductsServiceServer 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 RegisterProductsServiceHandlerFromEndpoint instead.
func RegisterProductsServiceServer ¶
func RegisterProductsServiceServer(s *grpc.Server, srv ProductsServiceServer)
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"` Price float64 `protobuf:"fixed64,3,opt,name=Price,proto3" json:"Price,omitempty"` AvailableQty int32 `protobuf:"varint,4,opt,name=AvailableQty,proto3" json:"AvailableQty,omitempty"` // contains filtered or unexported fields }
func (*Product) Descriptor
deprecated
func (*Product) GetAvailableQty ¶
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) ProtoReflect ¶
func (x *Product) ProtoReflect() protoreflect.Message
type Products ¶
type Products struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` // contains filtered or unexported fields }
func (*Products) Descriptor
deprecated
func (*Products) GetProducts ¶
func (*Products) ProtoMessage ¶
func (*Products) ProtoMessage()
func (*Products) ProtoReflect ¶
func (x *Products) ProtoReflect() protoreflect.Message
type ProductsServiceClient ¶
type ProductsServiceClient interface {
Find(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Products, error)
}
ProductsServiceClient is the client API for ProductsService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewProductsServiceClient ¶
func NewProductsServiceClient(cc grpc.ClientConnInterface) ProductsServiceClient
type ProductsServiceServer ¶
ProductsServiceServer is the server API for ProductsService service.
type UnimplementedProductsServiceServer ¶
type UnimplementedProductsServiceServer struct { }
UnimplementedProductsServiceServer can be embedded to have forward compatible implementations.