Documentation
¶
Overview ¶
Package person is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterSearchServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSearchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SearchServiceClient) error
- func RegisterSearchServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSearchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SearchServiceServer) error
- func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer)
- type PersonReq
- type PersonRes
- type SearchServiceClient
- type SearchServiceServer
- type UnimplementedSearchServiceServer
- type UnsafeSearchServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_personreq_person_proto protoreflect.FileDescriptor
var SearchService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "person.SearchService", HandlerType: (*SearchServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Search", Handler: _SearchService_Search_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "personreq/person.proto", }
SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterSearchServiceHandler ¶
func RegisterSearchServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterSearchServiceHandler registers the http handlers for service SearchService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSearchServiceHandlerClient ¶
func RegisterSearchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SearchServiceClient) error
RegisterSearchServiceHandlerClient registers the http handlers for service SearchService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SearchServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SearchServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SearchServiceClient" to call the correct interceptors.
func RegisterSearchServiceHandlerFromEndpoint ¶
func RegisterSearchServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterSearchServiceHandlerFromEndpoint is same as RegisterSearchServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSearchServiceHandlerServer ¶
func RegisterSearchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SearchServiceServer) error
RegisterSearchServiceHandlerServer registers the http handlers for service SearchService to "mux". UnaryRPC :call SearchServiceServer 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 RegisterSearchServiceHandlerFromEndpoint instead.
func RegisterSearchServiceServer ¶
func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer)
Types ¶
type PersonReq ¶
type PersonReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` // contains filtered or unexported fields }
func (*PersonReq) Descriptor
deprecated
func (*PersonReq) ProtoMessage ¶
func (*PersonReq) ProtoMessage()
func (*PersonReq) ProtoReflect ¶
func (x *PersonReq) ProtoReflect() protoreflect.Message
type PersonRes ¶
type PersonRes struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` // contains filtered or unexported fields }
func (*PersonRes) Descriptor
deprecated
func (*PersonRes) ProtoMessage ¶
func (*PersonRes) ProtoMessage()
func (*PersonRes) ProtoReflect ¶
func (x *PersonRes) ProtoReflect() protoreflect.Message
type SearchServiceClient ¶
type SearchServiceClient interface {
Search(ctx context.Context, in *PersonReq, opts ...grpc.CallOption) (*PersonRes, error)
}
SearchServiceClient is the client API for SearchService 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 NewSearchServiceClient ¶
func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient
type SearchServiceServer ¶
type SearchServiceServer interface { Search(context.Context, *PersonReq) (*PersonRes, error) // contains filtered or unexported methods }
SearchServiceServer is the server API for SearchService service. All implementations must embed UnimplementedSearchServiceServer for forward compatibility
type UnimplementedSearchServiceServer ¶
type UnimplementedSearchServiceServer struct { }
UnimplementedSearchServiceServer must be embedded to have forward compatible implementations.
type UnsafeSearchServiceServer ¶
type UnsafeSearchServiceServer interface {
// contains filtered or unexported methods
}
UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SearchServiceServer will result in compilation errors.