order

package
v0.0.0-...-e3dbeff Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package order is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_idl_order_order_proto protoreflect.FileDescriptor
View Source
var OrderService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "order.OrderService",
	HandlerType: (*OrderServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _OrderService_Create_Handler,
		},
		{
			MethodName: "Read",
			Handler:    _OrderService_Read_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "idl/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 CreateOrderReq

type CreateOrderReq struct {
	Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateOrderReq) Descriptor deprecated

func (*CreateOrderReq) Descriptor() ([]byte, []int)

Deprecated: Use CreateOrderReq.ProtoReflect.Descriptor instead.

func (*CreateOrderReq) GetOrder

func (x *CreateOrderReq) GetOrder() *Order

func (*CreateOrderReq) ProtoMessage

func (*CreateOrderReq) ProtoMessage()

func (*CreateOrderReq) ProtoReflect

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

func (*CreateOrderReq) Reset

func (x *CreateOrderReq) Reset()

func (*CreateOrderReq) String

func (x *CreateOrderReq) String() string

type CreateOrderResp

type CreateOrderResp struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateOrderResp) Descriptor deprecated

func (*CreateOrderResp) Descriptor() ([]byte, []int)

Deprecated: Use CreateOrderResp.ProtoReflect.Descriptor instead.

func (*CreateOrderResp) GetId

func (x *CreateOrderResp) GetId() int64

func (*CreateOrderResp) ProtoMessage

func (*CreateOrderResp) ProtoMessage()

func (*CreateOrderResp) ProtoReflect

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

func (*CreateOrderResp) Reset

func (x *CreateOrderResp) Reset()

func (*CreateOrderResp) String

func (x *CreateOrderResp) String() string

type Order

type Order struct {
	Id       int64      `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name     string     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Date     int64      `protobuf:"varint,3,opt,name=date,proto3" json:"date,omitempty"`
	Products []*Product `protobuf:"bytes,4,rep,name=products,proto3" json:"products,omitempty"`
	Ip       string     `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`
	// contains filtered or unexported fields
}

func (*Order) Descriptor deprecated

func (*Order) Descriptor() ([]byte, []int)

Deprecated: Use Order.ProtoReflect.Descriptor instead.

func (*Order) GetDate

func (x *Order) GetDate() int64

func (*Order) GetId

func (x *Order) GetId() int64

func (*Order) GetIp

func (x *Order) GetIp() string

func (*Order) GetName

func (x *Order) GetName() string

func (*Order) GetProducts

func (x *Order) GetProducts() []*Product

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 OrderServiceClient

type OrderServiceClient interface {
	Create(ctx context.Context, in *CreateOrderReq, opts ...grpc.CallOption) (*CreateOrderResp, error)
	Read(ctx context.Context, in *ReadOrderReq, opts ...grpc.CallOption) (*ReadOrderResp, 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.

type OrderServiceServer

type OrderServiceServer interface {
	Create(context.Context, *CreateOrderReq) (*CreateOrderResp, error)
	Read(context.Context, *ReadOrderReq) (*ReadOrderResp, error)
	// contains filtered or unexported methods
}

OrderServiceServer is the server API for OrderService service. All implementations must embed UnimplementedOrderServiceServer for forward compatibility

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"`
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Price       int32  `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"`
	// contains filtered or unexported fields
}

func (*Product) Descriptor deprecated

func (*Product) Descriptor() ([]byte, []int)

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetDescription

func (x *Product) GetDescription() string

func (*Product) GetId

func (x *Product) GetId() string

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetPrice

func (x *Product) GetPrice() int32

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

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

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type ReadOrderReq

type ReadOrderReq struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadOrderReq) Descriptor deprecated

func (*ReadOrderReq) Descriptor() ([]byte, []int)

Deprecated: Use ReadOrderReq.ProtoReflect.Descriptor instead.

func (*ReadOrderReq) GetId

func (x *ReadOrderReq) GetId() int64

func (*ReadOrderReq) ProtoMessage

func (*ReadOrderReq) ProtoMessage()

func (*ReadOrderReq) ProtoReflect

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

func (*ReadOrderReq) Reset

func (x *ReadOrderReq) Reset()

func (*ReadOrderReq) String

func (x *ReadOrderReq) String() string

type ReadOrderResp

type ReadOrderResp struct {
	Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadOrderResp) Descriptor deprecated

func (*ReadOrderResp) Descriptor() ([]byte, []int)

Deprecated: Use ReadOrderResp.ProtoReflect.Descriptor instead.

func (*ReadOrderResp) GetOrder

func (x *ReadOrderResp) GetOrder() *Order

func (*ReadOrderResp) ProtoMessage

func (*ReadOrderResp) ProtoMessage()

func (*ReadOrderResp) ProtoReflect

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

func (*ReadOrderResp) Reset

func (x *ReadOrderResp) Reset()

func (*ReadOrderResp) String

func (x *ReadOrderResp) String() string

type UnimplementedOrderServiceServer

type UnimplementedOrderServiceServer struct {
}

UnimplementedOrderServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedOrderServiceServer) Create

func (UnimplementedOrderServiceServer) Read

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.

Jump to

Keyboard shortcuts

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