Documentation ¶
Overview ¶
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func Init(host string, timeout int64, opts ...rpcx.ClientOption)
- func RegisterPrintServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPrintServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PrintServiceClient) error
- func RegisterPrintServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPrintServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PrintServiceServer) error
- func RegisterPrintServiceServer(s *grpc.Server, srv PrintServiceServer)
- type PrintServiceClient
- type PrintServiceServer
- type Request
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetCode() uint32
- func (x *Response) GetData() string
- func (x *Response) GetMessage() string
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type UnimplementedPrintServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_print_proto protoreflect.FileDescriptor
var Rpc *rpcx.DirectClient
Functions ¶
func RegisterPrintServiceHandler ¶
func RegisterPrintServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPrintServiceHandler registers the http handlers for service PrintService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPrintServiceHandlerClient ¶
func RegisterPrintServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PrintServiceClient) error
RegisterPrintServiceHandlerClient registers the http handlers for service PrintService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PrintServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PrintServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PrintServiceClient" to call the correct interceptors.
func RegisterPrintServiceHandlerFromEndpoint ¶
func RegisterPrintServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPrintServiceHandlerFromEndpoint is same as RegisterPrintServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPrintServiceHandlerServer ¶
func RegisterPrintServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PrintServiceServer) error
RegisterPrintServiceHandlerServer registers the http handlers for service PrintService to "mux". UnaryRPC :call PrintServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
func RegisterPrintServiceServer ¶
func RegisterPrintServiceServer(s *grpc.Server, srv PrintServiceServer)
Types ¶
type PrintServiceClient ¶
type PrintServiceClient interface {
PrintOK(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}
PrintServiceClient is the client API for PrintService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewPrintServiceClient ¶
func NewPrintServiceClient(cc grpc.ClientConnInterface) PrintServiceClient
type PrintServiceServer ¶
PrintServiceServer is the server API for PrintService service.
type Request ¶
type Request struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) GetMessage ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) GetMessage ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type UnimplementedPrintServiceServer ¶
type UnimplementedPrintServiceServer struct { }
UnimplementedPrintServiceServer can be embedded to have forward compatible implementations.