Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterOrderHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterOrderHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderClient) error
- func RegisterOrderHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterOrderHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServer) error
- func RegisterOrderServer(s grpc.ServiceRegistrar, srv OrderServer)
- type CreateOrderRequest
- func (*CreateOrderRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateOrderRequest) GetOrderItems() []*OrderItem
- func (x *CreateOrderRequest) GetUserId() int64
- 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) GetOrderId() int64
- func (*CreateOrderResponse) ProtoMessage()
- func (x *CreateOrderResponse) ProtoReflect() protoreflect.Message
- func (x *CreateOrderResponse) Reset()
- func (x *CreateOrderResponse) String() string
- type GetOrderRequest
- type GetOrderResponse
- func (*GetOrderResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetOrderResponse) GetOrderItems() []*OrderItem
- func (x *GetOrderResponse) GetUserId() int64
- func (*GetOrderResponse) ProtoMessage()
- func (x *GetOrderResponse) ProtoReflect() protoreflect.Message
- func (x *GetOrderResponse) Reset()
- func (x *GetOrderResponse) String() string
- type OrderClient
- type OrderItem
- func (*OrderItem) Descriptor() ([]byte, []int)deprecated
- func (x *OrderItem) GetProductCode() string
- func (x *OrderItem) GetQuantity() int32
- func (x *OrderItem) GetUnitPrice() float32
- func (*OrderItem) ProtoMessage()
- func (x *OrderItem) ProtoReflect() protoreflect.Message
- func (x *OrderItem) Reset()
- func (x *OrderItem) String() string
- type OrderServer
- type UnimplementedOrderServer
- type UnsafeOrderServer
Constants ¶
const ( Order_Create_FullMethodName = "/order.v1.Order/Create" Order_Get_FullMethodName = "/order.v1.Order/Get" )
Variables ¶
var File_order_v1_order_proto protoreflect.FileDescriptor
var Order_ServiceDesc = grpc.ServiceDesc{ ServiceName: "order.v1.Order", HandlerType: (*OrderServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _Order_Create_Handler, }, { MethodName: "Get", Handler: _Order_Get_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "order/v1/order.proto", }
Order_ServiceDesc is the grpc.ServiceDesc for Order service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterOrderHandler ¶
RegisterOrderHandler registers the http handlers for service Order to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterOrderHandlerClient ¶
func RegisterOrderHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderClient) error
RegisterOrderHandlerClient registers the http handlers for service Order to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OrderClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OrderClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OrderClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterOrderHandlerFromEndpoint ¶
func RegisterOrderHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterOrderHandlerFromEndpoint is same as RegisterOrderHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterOrderHandlerServer ¶
func RegisterOrderHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServer) error
RegisterOrderHandlerServer registers the http handlers for service Order to "mux". UnaryRPC :call OrderServer 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 RegisterOrderHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterOrderServer ¶
func RegisterOrderServer(s grpc.ServiceRegistrar, srv OrderServer)
Types ¶
type CreateOrderRequest ¶
type CreateOrderRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` OrderItems []*OrderItem `protobuf:"bytes,2,rep,name=order_items,json=orderItems,proto3" json:"order_items,omitempty"` // contains filtered or unexported fields }
func (*CreateOrderRequest) Descriptor
deprecated
func (*CreateOrderRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateOrderRequest.ProtoReflect.Descriptor instead.
func (*CreateOrderRequest) GetOrderItems ¶
func (x *CreateOrderRequest) GetOrderItems() []*OrderItem
func (*CreateOrderRequest) GetUserId ¶
func (x *CreateOrderRequest) GetUserId() int64
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 { OrderId int64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` // contains filtered or unexported fields }
func (*CreateOrderResponse) Descriptor
deprecated
func (*CreateOrderResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateOrderResponse.ProtoReflect.Descriptor instead.
func (*CreateOrderResponse) GetOrderId ¶
func (x *CreateOrderResponse) GetOrderId() int64
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 GetOrderRequest ¶
type GetOrderRequest struct { OrderId int64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` // contains filtered or unexported fields }
func (*GetOrderRequest) Descriptor
deprecated
func (*GetOrderRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderRequest.ProtoReflect.Descriptor instead.
func (*GetOrderRequest) GetOrderId ¶
func (x *GetOrderRequest) GetOrderId() int64
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 { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` OrderItems []*OrderItem `protobuf:"bytes,2,rep,name=order_items,json=orderItems,proto3" json:"order_items,omitempty"` // contains filtered or unexported fields }
func (*GetOrderResponse) Descriptor
deprecated
func (*GetOrderResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetOrderResponse.ProtoReflect.Descriptor instead.
func (*GetOrderResponse) GetOrderItems ¶
func (x *GetOrderResponse) GetOrderItems() []*OrderItem
func (*GetOrderResponse) GetUserId ¶
func (x *GetOrderResponse) GetUserId() int64
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 OrderClient ¶
type OrderClient interface { Create(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) Get(ctx context.Context, in *GetOrderRequest, opts ...grpc.CallOption) (*GetOrderResponse, error) }
OrderClient is the client API for Order 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 NewOrderClient ¶
func NewOrderClient(cc grpc.ClientConnInterface) OrderClient
type OrderItem ¶
type OrderItem struct { ProductCode string `protobuf:"bytes,1,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"` UnitPrice float32 `protobuf:"fixed32,2,opt,name=unit_price,json=unitPrice,proto3" json:"unit_price,omitempty"` Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"` // contains filtered or unexported fields }
func (*OrderItem) Descriptor
deprecated
func (*OrderItem) GetProductCode ¶
func (*OrderItem) GetQuantity ¶
func (*OrderItem) GetUnitPrice ¶
func (*OrderItem) ProtoMessage ¶
func (*OrderItem) ProtoMessage()
func (*OrderItem) ProtoReflect ¶
func (x *OrderItem) ProtoReflect() protoreflect.Message
type OrderServer ¶
type OrderServer interface { Create(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) Get(context.Context, *GetOrderRequest) (*GetOrderResponse, error) }
OrderServer is the server API for Order service. All implementations should embed UnimplementedOrderServer for forward compatibility.
type UnimplementedOrderServer ¶
type UnimplementedOrderServer struct{}
UnimplementedOrderServer should be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedOrderServer) Create ¶
func (UnimplementedOrderServer) Create(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error)
func (UnimplementedOrderServer) Get ¶
func (UnimplementedOrderServer) Get(context.Context, *GetOrderRequest) (*GetOrderResponse, error)
type UnsafeOrderServer ¶
type UnsafeOrderServer interface {
// contains filtered or unexported methods
}
UnsafeOrderServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OrderServer will result in compilation errors.