Documentation ¶
Overview ¶
Package ordersv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterOrdersServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterOrdersServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrdersServiceClient) error
- func RegisterOrdersServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterOrdersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrdersServiceServer) error
- func RegisterOrdersServiceServer(s grpc.ServiceRegistrar, srv OrdersServiceServer)
- type CreateOrderRequest
- func (*CreateOrderRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateOrderRequest) GetOrder() *Order
- func (*CreateOrderRequest) ProtoMessage()
- func (x *CreateOrderRequest) ProtoReflect() protoreflect.Message
- func (x *CreateOrderRequest) Reset()
- func (x *CreateOrderRequest) String() string
- type CreateOrderResponse
- func (*CreateOrderResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateOrderResponse) GetOrder() *Order
- func (*CreateOrderResponse) ProtoMessage()
- func (x *CreateOrderResponse) ProtoReflect() protoreflect.Message
- func (x *CreateOrderResponse) Reset()
- func (x *CreateOrderResponse) String() string
- type Empty
- type GetOrderRequest
- type GetOrderResponse
- type ListOrdersResponse
- func (*ListOrdersResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListOrdersResponse) GetOrders() []*Order
- func (*ListOrdersResponse) ProtoMessage()
- func (x *ListOrdersResponse) ProtoReflect() protoreflect.Message
- func (x *ListOrdersResponse) Reset()
- func (x *ListOrdersResponse) String() string
- type Order
- type OrdersServiceClient
- type OrdersServiceServer
- type UnimplementedOrdersServiceServer
- type UnsafeOrdersServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_orders_v1_orders_proto protoreflect.FileDescriptor
var OrdersService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "orders.v1.OrdersService", HandlerType: (*OrdersServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListOrders", Handler: _OrdersService_ListOrders_Handler, }, { MethodName: "CreateOrder", Handler: _OrdersService_CreateOrder_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "orders/v1/orders.proto", }
OrdersService_ServiceDesc is the grpc.ServiceDesc for OrdersService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterOrdersServiceHandler ¶
func RegisterOrdersServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterOrdersServiceHandler registers the http handlers for service OrdersService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterOrdersServiceHandlerClient ¶
func RegisterOrdersServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrdersServiceClient) error
RegisterOrdersServiceHandlerClient registers the http handlers for service OrdersService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OrdersServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OrdersServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OrdersServiceClient" to call the correct interceptors.
func RegisterOrdersServiceHandlerFromEndpoint ¶
func RegisterOrdersServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterOrdersServiceHandlerFromEndpoint is same as RegisterOrdersServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterOrdersServiceHandlerServer ¶
func RegisterOrdersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrdersServiceServer) error
RegisterOrdersServiceHandlerServer registers the http handlers for service OrdersService to "mux". UnaryRPC :call OrdersServiceServer 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 RegisterOrdersServiceHandlerFromEndpoint instead.
func RegisterOrdersServiceServer ¶
func RegisterOrdersServiceServer(s grpc.ServiceRegistrar, srv OrdersServiceServer)
Types ¶
type CreateOrderRequest ¶
type CreateOrderRequest struct { Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"` // contains filtered or unexported fields }
func (*CreateOrderRequest) Descriptor
deprecated
func (*CreateOrderRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateOrderRequest.ProtoReflect.Descriptor instead.
func (*CreateOrderRequest) GetOrder ¶
func (x *CreateOrderRequest) GetOrder() *Order
func (*CreateOrderRequest) ProtoMessage ¶
func (*CreateOrderRequest) ProtoMessage()
func (*CreateOrderRequest) ProtoReflect ¶
func (x *CreateOrderRequest) ProtoReflect() protoreflect.Message
func (*CreateOrderRequest) Reset ¶
func (x *CreateOrderRequest) Reset()
func (*CreateOrderRequest) String ¶
func (x *CreateOrderRequest) String() string
type CreateOrderResponse ¶
type CreateOrderResponse struct { Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"` // contains filtered or unexported fields }
func (*CreateOrderResponse) Descriptor
deprecated
func (*CreateOrderResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateOrderResponse.ProtoReflect.Descriptor instead.
func (*CreateOrderResponse) GetOrder ¶
func (x *CreateOrderResponse) GetOrder() *Order
func (*CreateOrderResponse) ProtoMessage ¶
func (*CreateOrderResponse) ProtoMessage()
func (*CreateOrderResponse) ProtoReflect ¶
func (x *CreateOrderResponse) ProtoReflect() protoreflect.Message
func (*CreateOrderResponse) Reset ¶
func (x *CreateOrderResponse) Reset()
func (*CreateOrderResponse) String ¶
func (x *CreateOrderResponse) String() string
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type GetOrderRequest ¶
type GetOrderRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetOrderRequest) Descriptor
deprecated
func (*GetOrderRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderRequest.ProtoReflect.Descriptor instead.
func (*GetOrderRequest) GetId ¶
func (x *GetOrderRequest) GetId() string
func (*GetOrderRequest) ProtoMessage ¶
func (*GetOrderRequest) ProtoMessage()
func (*GetOrderRequest) ProtoReflect ¶
func (x *GetOrderRequest) ProtoReflect() protoreflect.Message
func (*GetOrderRequest) Reset ¶
func (x *GetOrderRequest) Reset()
func (*GetOrderRequest) String ¶
func (x *GetOrderRequest) String() string
type GetOrderResponse ¶
type GetOrderResponse struct { Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"` // contains filtered or unexported fields }
func (*GetOrderResponse) Descriptor
deprecated
func (*GetOrderResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderResponse.ProtoReflect.Descriptor instead.
func (*GetOrderResponse) GetOrder ¶
func (x *GetOrderResponse) GetOrder() *Order
func (*GetOrderResponse) ProtoMessage ¶
func (*GetOrderResponse) ProtoMessage()
func (*GetOrderResponse) ProtoReflect ¶
func (x *GetOrderResponse) ProtoReflect() protoreflect.Message
func (*GetOrderResponse) Reset ¶
func (x *GetOrderResponse) Reset()
func (*GetOrderResponse) String ¶
func (x *GetOrderResponse) String() string
type ListOrdersResponse ¶
type ListOrdersResponse struct { Orders []*Order `protobuf:"bytes,1,rep,name=orders,proto3" json:"orders,omitempty"` // contains filtered or unexported fields }
func (*ListOrdersResponse) Descriptor
deprecated
func (*ListOrdersResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListOrdersResponse.ProtoReflect.Descriptor instead.
func (*ListOrdersResponse) GetOrders ¶
func (x *ListOrdersResponse) GetOrders() []*Order
func (*ListOrdersResponse) ProtoMessage ¶
func (*ListOrdersResponse) ProtoMessage()
func (*ListOrdersResponse) ProtoReflect ¶
func (x *ListOrdersResponse) ProtoReflect() protoreflect.Message
func (*ListOrdersResponse) Reset ¶
func (x *ListOrdersResponse) Reset()
func (*ListOrdersResponse) String ¶
func (x *ListOrdersResponse) String() string
type Order ¶
type Order struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Amount int32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // contains filtered or unexported fields }
func (*Order) Descriptor
deprecated
func (*Order) ProtoMessage ¶
func (*Order) ProtoMessage()
func (*Order) ProtoReflect ¶
func (x *Order) ProtoReflect() protoreflect.Message
type OrdersServiceClient ¶
type OrdersServiceClient interface { ListOrders(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListOrdersResponse, error) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) }
OrdersServiceClient is the client API for OrdersService 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 NewOrdersServiceClient ¶
func NewOrdersServiceClient(cc grpc.ClientConnInterface) OrdersServiceClient
type OrdersServiceServer ¶
type OrdersServiceServer interface { ListOrders(context.Context, *emptypb.Empty) (*ListOrdersResponse, error) CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) }
OrdersServiceServer is the server API for OrdersService service. All implementations should embed UnimplementedOrdersServiceServer for forward compatibility
type UnimplementedOrdersServiceServer ¶
type UnimplementedOrdersServiceServer struct { }
UnimplementedOrdersServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedOrdersServiceServer) CreateOrder ¶
func (UnimplementedOrdersServiceServer) CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error)
func (UnimplementedOrdersServiceServer) ListOrders ¶
func (UnimplementedOrdersServiceServer) ListOrders(context.Context, *emptypb.Empty) (*ListOrdersResponse, error)
type UnsafeOrdersServiceServer ¶
type UnsafeOrdersServiceServer interface {
// contains filtered or unexported methods
}
UnsafeOrdersServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OrdersServiceServer will result in compilation errors.