Documentation ¶
Overview ¶
Package order is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterOrderServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterOrderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderServiceClient) error
- func RegisterOrderServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterOrderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServiceServer) error
- func RegisterOrderServiceServer(s grpc.ServiceRegistrar, srv OrderServiceServer)
- type GetOrderByIdRequest
- func (*GetOrderByIdRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetOrderByIdRequest) GetOrderId() string
- func (*GetOrderByIdRequest) ProtoMessage()
- func (x *GetOrderByIdRequest) ProtoReflect() protoreflect.Message
- func (x *GetOrderByIdRequest) Reset()
- func (x *GetOrderByIdRequest) String() string
- type GetOrderByStatusRequest
- func (*GetOrderByStatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetOrderByStatusRequest) GetStatus() string
- func (*GetOrderByStatusRequest) ProtoMessage()
- func (x *GetOrderByStatusRequest) ProtoReflect() protoreflect.Message
- func (x *GetOrderByStatusRequest) Reset()
- func (x *GetOrderByStatusRequest) String() string
- type Order
- func (*Order) Descriptor() ([]byte, []int)deprecated
- func (x *Order) GetDiscount() int32
- func (x *Order) GetDispatchDate() string
- func (x *Order) GetId() string
- func (x *Order) GetOrderValue() int32
- func (x *Order) GetProductId() string
- func (x *Order) GetQuantity() int32
- func (x *Order) GetStatus() string
- func (*Order) ProtoMessage()
- func (x *Order) ProtoReflect() protoreflect.Message
- func (x *Order) Reset()
- func (x *Order) String() string
- type OrderServiceClient
- type OrderServiceServer
- type OrderStatus
- type PlaceOrder
- type PlaceOrderRequest
- func (*PlaceOrderRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PlaceOrderRequest) GetPlaceOrder() []*PlaceOrder
- func (*PlaceOrderRequest) ProtoMessage()
- func (x *PlaceOrderRequest) ProtoReflect() protoreflect.Message
- func (x *PlaceOrderRequest) Reset()
- func (x *PlaceOrderRequest) String() string
- type PlaceOrderResponse
- func (*PlaceOrderResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PlaceOrderResponse) GetOrders() []*Order
- func (*PlaceOrderResponse) ProtoMessage()
- func (x *PlaceOrderResponse) ProtoReflect() protoreflect.Message
- func (x *PlaceOrderResponse) Reset()
- func (x *PlaceOrderResponse) String() string
- type UnimplementedOrderServiceServer
- func (UnimplementedOrderServiceServer) GetAllOrder(context.Context, *emptypb.Empty) (*OrderStatus, error)
- func (UnimplementedOrderServiceServer) GetOrderById(context.Context, *GetOrderByIdRequest) (*Order, error)
- func (UnimplementedOrderServiceServer) GetOrderByStatus(context.Context, *GetOrderByStatusRequest) (*OrderStatus, error)
- func (UnimplementedOrderServiceServer) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error)
- func (UnimplementedOrderServiceServer) UpdateOrderStatus(context.Context, *UpdateOrderStatusRequest) (*Order, error)
- type UnsafeOrderServiceServer
- type UpdateOrderStatusRequest
- func (*UpdateOrderStatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateOrderStatusRequest) GetOrderId() string
- func (x *UpdateOrderStatusRequest) GetStatus() string
- func (*UpdateOrderStatusRequest) ProtoMessage()
- func (x *UpdateOrderStatusRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateOrderStatusRequest) Reset()
- func (x *UpdateOrderStatusRequest) String() string
Constants ¶
This section is empty.
Variables ¶
var File_protos_order_order_proto protoreflect.FileDescriptor
var OrderService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "orderpb.OrderService", HandlerType: (*OrderServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "PlaceOrder", Handler: _OrderService_PlaceOrder_Handler, }, { MethodName: "GetOrderByStatus", Handler: _OrderService_GetOrderByStatus_Handler, }, { MethodName: "GetOrderById", Handler: _OrderService_GetOrderById_Handler, }, { MethodName: "GetAllOrder", Handler: _OrderService_GetAllOrder_Handler, }, { MethodName: "UpdateOrderStatus", Handler: _OrderService_UpdateOrderStatus_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "protos/order/order.proto", }
OrderService_ServiceDesc is the grpc.ServiceDesc for OrderService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterOrderServiceHandler ¶
func RegisterOrderServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterOrderServiceHandler registers the http handlers for service OrderService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterOrderServiceHandlerClient ¶
func RegisterOrderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderServiceClient) error
RegisterOrderServiceHandlerClient registers the http handlers for service OrderService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OrderServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OrderServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OrderServiceClient" to call the correct interceptors.
func RegisterOrderServiceHandlerFromEndpoint ¶
func RegisterOrderServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterOrderServiceHandlerFromEndpoint is same as RegisterOrderServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterOrderServiceHandlerServer ¶
func RegisterOrderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServiceServer) error
RegisterOrderServiceHandlerServer registers the http handlers for service OrderService to "mux". UnaryRPC :call OrderServiceServer 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 RegisterOrderServiceHandlerFromEndpoint instead.
func RegisterOrderServiceServer ¶
func RegisterOrderServiceServer(s grpc.ServiceRegistrar, srv OrderServiceServer)
Types ¶
type GetOrderByIdRequest ¶
type GetOrderByIdRequest struct { OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` // contains filtered or unexported fields }
func (*GetOrderByIdRequest) Descriptor
deprecated
func (*GetOrderByIdRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderByIdRequest.ProtoReflect.Descriptor instead.
func (*GetOrderByIdRequest) GetOrderId ¶
func (x *GetOrderByIdRequest) GetOrderId() string
func (*GetOrderByIdRequest) ProtoMessage ¶
func (*GetOrderByIdRequest) ProtoMessage()
func (*GetOrderByIdRequest) ProtoReflect ¶
func (x *GetOrderByIdRequest) ProtoReflect() protoreflect.Message
func (*GetOrderByIdRequest) Reset ¶
func (x *GetOrderByIdRequest) Reset()
func (*GetOrderByIdRequest) String ¶
func (x *GetOrderByIdRequest) String() string
type GetOrderByStatusRequest ¶
type GetOrderByStatusRequest struct { Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*GetOrderByStatusRequest) Descriptor
deprecated
func (*GetOrderByStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderByStatusRequest.ProtoReflect.Descriptor instead.
func (*GetOrderByStatusRequest) GetStatus ¶
func (x *GetOrderByStatusRequest) GetStatus() string
func (*GetOrderByStatusRequest) ProtoMessage ¶
func (*GetOrderByStatusRequest) ProtoMessage()
func (*GetOrderByStatusRequest) ProtoReflect ¶
func (x *GetOrderByStatusRequest) ProtoReflect() protoreflect.Message
func (*GetOrderByStatusRequest) Reset ¶
func (x *GetOrderByStatusRequest) Reset()
func (*GetOrderByStatusRequest) String ¶
func (x *GetOrderByStatusRequest) String() string
type Order ¶
type Order struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ProductId string `protobuf:"bytes,2,opt,name=productId,proto3" json:"productId,omitempty"` Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"` Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` OrderValue int32 `protobuf:"varint,5,opt,name=orderValue,proto3" json:"orderValue,omitempty"` DispatchDate string `protobuf:"bytes,6,opt,name=dispatchDate,proto3" json:"dispatchDate,omitempty"` Discount int32 `protobuf:"varint,7,opt,name=discount,proto3" json:"discount,omitempty"` // contains filtered or unexported fields }
func (*Order) Descriptor
deprecated
func (*Order) GetDiscount ¶
func (*Order) GetDispatchDate ¶
func (*Order) GetOrderValue ¶
func (*Order) GetProductId ¶
func (*Order) GetQuantity ¶
func (*Order) ProtoMessage ¶
func (*Order) ProtoMessage()
func (*Order) ProtoReflect ¶
func (x *Order) ProtoReflect() protoreflect.Message
type OrderServiceClient ¶
type OrderServiceClient interface { PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) GetOrderByStatus(ctx context.Context, in *GetOrderByStatusRequest, opts ...grpc.CallOption) (*OrderStatus, error) GetOrderById(ctx context.Context, in *GetOrderByIdRequest, opts ...grpc.CallOption) (*Order, error) GetAllOrder(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*OrderStatus, error) UpdateOrderStatus(ctx context.Context, in *UpdateOrderStatusRequest, opts ...grpc.CallOption) (*Order, error) }
OrderServiceClient is the client API for OrderService 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 NewOrderServiceClient ¶
func NewOrderServiceClient(cc grpc.ClientConnInterface) OrderServiceClient
type OrderServiceServer ¶
type OrderServiceServer interface { PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) GetOrderByStatus(context.Context, *GetOrderByStatusRequest) (*OrderStatus, error) GetOrderById(context.Context, *GetOrderByIdRequest) (*Order, error) GetAllOrder(context.Context, *emptypb.Empty) (*OrderStatus, error) UpdateOrderStatus(context.Context, *UpdateOrderStatusRequest) (*Order, error) // contains filtered or unexported methods }
OrderServiceServer is the server API for OrderService service. All implementations must embed UnimplementedOrderServiceServer for forward compatibility
type OrderStatus ¶
type OrderStatus struct { Orders []*Order `protobuf:"bytes,1,rep,name=orders,proto3" json:"orders,omitempty"` // contains filtered or unexported fields }
func (*OrderStatus) Descriptor
deprecated
func (*OrderStatus) Descriptor() ([]byte, []int)
Deprecated: Use OrderStatus.ProtoReflect.Descriptor instead.
func (*OrderStatus) GetOrders ¶
func (x *OrderStatus) GetOrders() []*Order
func (*OrderStatus) ProtoMessage ¶
func (*OrderStatus) ProtoMessage()
func (*OrderStatus) ProtoReflect ¶
func (x *OrderStatus) ProtoReflect() protoreflect.Message
func (*OrderStatus) Reset ¶
func (x *OrderStatus) Reset()
func (*OrderStatus) String ¶
func (x *OrderStatus) String() string
type PlaceOrder ¶
type PlaceOrder struct { ProductId string `protobuf:"bytes,1,opt,name=productId,proto3" json:"productId,omitempty"` Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` // contains filtered or unexported fields }
func (*PlaceOrder) Descriptor
deprecated
func (*PlaceOrder) Descriptor() ([]byte, []int)
Deprecated: Use PlaceOrder.ProtoReflect.Descriptor instead.
func (*PlaceOrder) GetProductId ¶
func (x *PlaceOrder) GetProductId() string
func (*PlaceOrder) GetQuantity ¶
func (x *PlaceOrder) GetQuantity() int32
func (*PlaceOrder) ProtoMessage ¶
func (*PlaceOrder) ProtoMessage()
func (*PlaceOrder) ProtoReflect ¶
func (x *PlaceOrder) ProtoReflect() protoreflect.Message
func (*PlaceOrder) Reset ¶
func (x *PlaceOrder) Reset()
func (*PlaceOrder) String ¶
func (x *PlaceOrder) String() string
type PlaceOrderRequest ¶
type PlaceOrderRequest struct { PlaceOrder []*PlaceOrder `protobuf:"bytes,1,rep,name=placeOrder,proto3" json:"placeOrder,omitempty"` // contains filtered or unexported fields }
func (*PlaceOrderRequest) Descriptor
deprecated
func (*PlaceOrderRequest) Descriptor() ([]byte, []int)
Deprecated: Use PlaceOrderRequest.ProtoReflect.Descriptor instead.
func (*PlaceOrderRequest) GetPlaceOrder ¶
func (x *PlaceOrderRequest) GetPlaceOrder() []*PlaceOrder
func (*PlaceOrderRequest) ProtoMessage ¶
func (*PlaceOrderRequest) ProtoMessage()
func (*PlaceOrderRequest) ProtoReflect ¶
func (x *PlaceOrderRequest) ProtoReflect() protoreflect.Message
func (*PlaceOrderRequest) Reset ¶
func (x *PlaceOrderRequest) Reset()
func (*PlaceOrderRequest) String ¶
func (x *PlaceOrderRequest) String() string
type PlaceOrderResponse ¶
type PlaceOrderResponse struct { Orders []*Order `protobuf:"bytes,1,rep,name=orders,proto3" json:"orders,omitempty"` // contains filtered or unexported fields }
func (*PlaceOrderResponse) Descriptor
deprecated
func (*PlaceOrderResponse) Descriptor() ([]byte, []int)
Deprecated: Use PlaceOrderResponse.ProtoReflect.Descriptor instead.
func (*PlaceOrderResponse) GetOrders ¶
func (x *PlaceOrderResponse) GetOrders() []*Order
func (*PlaceOrderResponse) ProtoMessage ¶
func (*PlaceOrderResponse) ProtoMessage()
func (*PlaceOrderResponse) ProtoReflect ¶
func (x *PlaceOrderResponse) ProtoReflect() protoreflect.Message
func (*PlaceOrderResponse) Reset ¶
func (x *PlaceOrderResponse) Reset()
func (*PlaceOrderResponse) String ¶
func (x *PlaceOrderResponse) String() string
type UnimplementedOrderServiceServer ¶
type UnimplementedOrderServiceServer struct { }
UnimplementedOrderServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedOrderServiceServer) GetAllOrder ¶
func (UnimplementedOrderServiceServer) GetAllOrder(context.Context, *emptypb.Empty) (*OrderStatus, error)
func (UnimplementedOrderServiceServer) GetOrderById ¶
func (UnimplementedOrderServiceServer) GetOrderById(context.Context, *GetOrderByIdRequest) (*Order, error)
func (UnimplementedOrderServiceServer) GetOrderByStatus ¶
func (UnimplementedOrderServiceServer) GetOrderByStatus(context.Context, *GetOrderByStatusRequest) (*OrderStatus, error)
func (UnimplementedOrderServiceServer) PlaceOrder ¶
func (UnimplementedOrderServiceServer) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error)
func (UnimplementedOrderServiceServer) UpdateOrderStatus ¶
func (UnimplementedOrderServiceServer) UpdateOrderStatus(context.Context, *UpdateOrderStatusRequest) (*Order, error)
type UnsafeOrderServiceServer ¶
type UnsafeOrderServiceServer interface {
// contains filtered or unexported methods
}
UnsafeOrderServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OrderServiceServer will result in compilation errors.
type UpdateOrderStatusRequest ¶
type UpdateOrderStatusRequest struct { OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*UpdateOrderStatusRequest) Descriptor
deprecated
func (*UpdateOrderStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateOrderStatusRequest.ProtoReflect.Descriptor instead.
func (*UpdateOrderStatusRequest) GetOrderId ¶
func (x *UpdateOrderStatusRequest) GetOrderId() string
func (*UpdateOrderStatusRequest) GetStatus ¶
func (x *UpdateOrderStatusRequest) GetStatus() string
func (*UpdateOrderStatusRequest) ProtoMessage ¶
func (*UpdateOrderStatusRequest) ProtoMessage()
func (*UpdateOrderStatusRequest) ProtoReflect ¶
func (x *UpdateOrderStatusRequest) ProtoReflect() protoreflect.Message
func (*UpdateOrderStatusRequest) Reset ¶
func (x *UpdateOrderStatusRequest) Reset()
func (*UpdateOrderStatusRequest) String ¶
func (x *UpdateOrderStatusRequest) String() string