Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error
- func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestServiceClient) error
- func RegisterTestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServiceServer) error
- func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
- type HelloReq
- type HelloRes
- type TestServiceClient
- type TestServiceServer
- type UnimplementedTestServiceServer
- type UnsafeTestServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_service_proto protoreflect.FileDescriptor
var TestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "your.service.v1.TestService", HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _TestService_Hello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "service.proto", }
TestService_ServiceDesc is the grpc.ServiceDesc for TestService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterTestServiceHandler ¶
func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error
RegisterTestServiceHandler registers the http handlers for service TestService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTestServiceHandlerClient ¶
func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestServiceClient) error
RegisterTestServiceHandlerClient registers the http handlers for service TestService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TestServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TestServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TestServiceClient" to call the correct interceptors.
func RegisterTestServiceHandlerFromEndpoint ¶
func RegisterTestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTestServiceHandlerFromEndpoint is same as RegisterTestServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTestServiceHandlerServer ¶
func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServiceServer) error
RegisterTestServiceHandlerServer registers the http handlers for service TestService to "mux". UnaryRPC :call TestServiceServer 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 RegisterTestServiceHandlerFromEndpoint instead.
func RegisterTestServiceServer ¶
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
Types ¶
type HelloReq ¶
type HelloReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*HelloReq) Descriptor
deprecated
func (*HelloReq) ProtoMessage ¶
func (*HelloReq) ProtoMessage()
func (*HelloReq) ProtoReflect ¶
func (x *HelloReq) ProtoReflect() protoreflect.Message
type HelloRes ¶
type HelloRes struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*HelloRes) Descriptor
deprecated
func (*HelloRes) ProtoMessage ¶
func (*HelloRes) ProtoMessage()
func (*HelloRes) ProtoReflect ¶
func (x *HelloRes) ProtoReflect() protoreflect.Message
type TestServiceClient ¶
type TestServiceClient interface {
Hello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloRes, error)
}
TestServiceClient is the client API for TestService 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 NewTestServiceClient ¶
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient
type TestServiceServer ¶
TestServiceServer is the server API for TestService service. All implementations should embed UnimplementedTestServiceServer for forward compatibility
type UnimplementedTestServiceServer ¶
type UnimplementedTestServiceServer struct { }
UnimplementedTestServiceServer should be embedded to have forward compatible implementations.
type UnsafeTestServiceServer ¶
type UnsafeTestServiceServer interface {
// contains filtered or unexported methods
}
UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TestServiceServer will result in compilation errors.