ordersv1

package
v0.0.0-...-29c9282 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package ordersv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_orders_v1_orders_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Order.ProtoReflect.Descriptor instead.

func (*Order) GetAmount

func (x *Order) GetAmount() int32

func (*Order) GetId

func (x *Order) GetId() string

func (*Order) ProtoMessage

func (*Order) ProtoMessage()

func (*Order) ProtoReflect

func (x *Order) ProtoReflect() protoreflect.Message

func (*Order) Reset

func (x *Order) Reset()

func (*Order) String

func (x *Order) String() string

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.

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) ListOrders

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL