Documentation ¶
Overview ¶
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error
- func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error
- func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer)
- type EchoMessage
- type EchoServiceClient
- type EchoServiceServer
- type UnimplementedEchoServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_echo_proto protoreflect.FileDescriptor
Functions ¶
func RegisterEchoServiceHandler ¶
func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterEchoServiceHandlerClient ¶
func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error
RegisterEchoServiceHandlerClient registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EchoServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EchoServiceClient" to call the correct interceptors.
func RegisterEchoServiceHandlerFromEndpoint ¶
func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterEchoServiceHandlerServer ¶
func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error
RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". UnaryRPC :call EchoServiceServer 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 RegisterEchoServiceHandlerFromEndpoint instead.
func RegisterEchoServiceServer ¶
func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer)
Types ¶
type EchoMessage ¶
type EchoMessage struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*EchoMessage) Descriptor
deprecated
func (*EchoMessage) Descriptor() ([]byte, []int)
Deprecated: Use EchoMessage.ProtoReflect.Descriptor instead.
func (*EchoMessage) GetMessage ¶
func (x *EchoMessage) GetMessage() string
func (*EchoMessage) ProtoMessage ¶
func (*EchoMessage) ProtoMessage()
func (*EchoMessage) ProtoReflect ¶
func (x *EchoMessage) ProtoReflect() protoreflect.Message
func (*EchoMessage) Reset ¶
func (x *EchoMessage) Reset()
func (*EchoMessage) String ¶
func (x *EchoMessage) String() string
type EchoServiceClient ¶
type EchoServiceClient interface {
Call(ctx context.Context, in *EchoMessage, opts ...grpc.CallOption) (*EchoMessage, error)
}
EchoServiceClient is the client API for EchoService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewEchoServiceClient ¶
func NewEchoServiceClient(cc grpc.ClientConnInterface) EchoServiceClient
type EchoServiceServer ¶
type EchoServiceServer interface {
Call(context.Context, *EchoMessage) (*EchoMessage, error)
}
EchoServiceServer is the server API for EchoService service.
type UnimplementedEchoServiceServer ¶
type UnimplementedEchoServiceServer struct { }
UnimplementedEchoServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedEchoServiceServer) Call ¶
func (*UnimplementedEchoServiceServer) Call(context.Context, *EchoMessage) (*EchoMessage, error)