person

package
v0.0.0-...-23bdc36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package person is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_personreq_person_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use PersonReq.ProtoReflect.Descriptor instead.

func (*PersonReq) GetAge

func (x *PersonReq) GetAge() int32

func (*PersonReq) GetName

func (x *PersonReq) GetName() string

func (*PersonReq) ProtoMessage

func (*PersonReq) ProtoMessage()

func (*PersonReq) ProtoReflect

func (x *PersonReq) ProtoReflect() protoreflect.Message

func (*PersonReq) Reset

func (x *PersonReq) Reset()

func (*PersonReq) String

func (x *PersonReq) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use PersonRes.ProtoReflect.Descriptor instead.

func (*PersonRes) GetAge

func (x *PersonRes) GetAge() int32

func (*PersonRes) GetName

func (x *PersonRes) GetName() string

func (*PersonRes) ProtoMessage

func (*PersonRes) ProtoMessage()

func (*PersonRes) ProtoReflect

func (x *PersonRes) ProtoReflect() protoreflect.Message

func (*PersonRes) Reset

func (x *PersonRes) Reset()

func (*PersonRes) String

func (x *PersonRes) String() string

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.

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.

func (UnimplementedSearchServiceServer) Search

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL