Documentation ¶
Overview ¶
Package grpc is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterExampleHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterExampleHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleClient) error
- func RegisterExampleHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterExampleHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServer) error
- func RegisterExampleServer(s grpc.ServiceRegistrar, srv ExampleServer)
- type ExampleClient
- type ExampleServer
- type PingResponse
- type UnimplementedExampleServer
- type UnsafeExampleServer
Constants ¶
This section is empty.
Variables ¶
var Example_ServiceDesc = grpc.ServiceDesc{ ServiceName: "example.v1.Example", HandlerType: (*ExampleServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Ping", Handler: _Example_Ping_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "example/v1/example.proto", }
Example_ServiceDesc is the grpc.ServiceDesc for Example service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_example_v1_example_proto protoreflect.FileDescriptor
Functions ¶
func RegisterExampleHandler ¶
func RegisterExampleHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterExampleHandler registers the http handlers for service Example to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterExampleHandlerClient ¶
func RegisterExampleHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleClient) error
RegisterExampleHandlerClient registers the http handlers for service Example to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ExampleClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ExampleClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ExampleClient" to call the correct interceptors.
func RegisterExampleHandlerFromEndpoint ¶
func RegisterExampleHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterExampleHandlerFromEndpoint is same as RegisterExampleHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterExampleHandlerServer ¶
func RegisterExampleHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServer) error
RegisterExampleHandlerServer registers the http handlers for service Example to "mux". UnaryRPC :call ExampleServer 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 RegisterExampleHandlerFromEndpoint instead.
func RegisterExampleServer ¶
func RegisterExampleServer(s grpc.ServiceRegistrar, srv ExampleServer)
Types ¶
type ExampleClient ¶
type ExampleClient interface { // Ping returns the <-pong message. Ping(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PingResponse, error) }
ExampleClient is the client API for Example service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewExampleClient ¶
func NewExampleClient(cc grpc.ClientConnInterface) ExampleClient
type ExampleServer ¶
type ExampleServer interface { // Ping returns the <-pong message. Ping(context.Context, *emptypb.Empty) (*PingResponse, error) }
ExampleServer is the server API for Example service. All implementations should embed UnimplementedExampleServer for forward compatibility
type PingResponse ¶
type PingResponse struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
PingResponse is the response from a Ping call.
func (*PingResponse) Descriptor
deprecated
func (*PingResponse) Descriptor() ([]byte, []int)
Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.
func (*PingResponse) GetMessage ¶
func (x *PingResponse) GetMessage() string
func (*PingResponse) ProtoMessage ¶
func (*PingResponse) ProtoMessage()
func (*PingResponse) ProtoReflect ¶
func (x *PingResponse) ProtoReflect() protoreflect.Message
func (*PingResponse) Reset ¶
func (x *PingResponse) Reset()
func (*PingResponse) String ¶
func (x *PingResponse) String() string
type UnimplementedExampleServer ¶
type UnimplementedExampleServer struct { }
UnimplementedExampleServer should be embedded to have forward compatible implementations.
func (UnimplementedExampleServer) Ping ¶
func (UnimplementedExampleServer) Ping(context.Context, *emptypb.Empty) (*PingResponse, error)
type UnsafeExampleServer ¶
type UnsafeExampleServer interface {
// contains filtered or unexported methods
}
UnsafeExampleServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExampleServer will result in compilation errors.