Documentation ¶
Overview ¶
Package hello is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func MicroRegisterSayHandler(s server.Server, hdlr SayHandler, opts ...server.HandlerOption) error
- func NewSayEndpoints() []*api.Endpoint
- func RegisterSayHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SayClient) error
- func RegisterSayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SayServer) error
- func RegisterSayServer(s grpc.ServiceRegistrar, srv SayServer)
- type Request
- type Response
- type SayClient
- type SayHandler
- type SayServer
- type SayService
- type UnimplementedSayServer
- type UnsafeSayServer
Constants ¶
const ( Say_Hello_FullMethodName = "/greeter.Say/Hello" Say_Message_FullMethodName = "/greeter.Say/Message" )
Variables ¶
var File_hello_hello_proto protoreflect.FileDescriptor
var Say_ServiceDesc = grpc.ServiceDesc{ ServiceName: "greeter.Say", HandlerType: (*SayServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _Say_Hello_Handler, }, { MethodName: "Message", Handler: _Say_Message_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "hello/hello.proto", }
Say_ServiceDesc is the grpc.ServiceDesc for Say service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func MicroRegisterSayHandler ¶
func MicroRegisterSayHandler(s server.Server, hdlr SayHandler, opts ...server.HandlerOption) error
func NewSayEndpoints ¶
func RegisterSayHandler ¶
RegisterSayHandler registers the http handlers for service Say to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSayHandlerClient ¶
RegisterSayHandlerClient registers the http handlers for service Say to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SayClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SayClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SayClient" to call the correct interceptors.
func RegisterSayHandlerFromEndpoint ¶
func RegisterSayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterSayHandlerFromEndpoint is same as RegisterSayHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSayHandlerServer ¶
RegisterSayHandlerServer registers the http handlers for service Say to "mux". UnaryRPC :call SayServer 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 RegisterSayHandlerFromEndpoint instead.
func RegisterSayServer ¶
func RegisterSayServer(s grpc.ServiceRegistrar, srv SayServer)
Types ¶
type Request ¶
type Request struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type SayClient ¶
type SayClient interface { Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) Message(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) }
SayClient is the client API for Say 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 NewSayClient ¶
func NewSayClient(cc grpc.ClientConnInterface) SayClient
type SayHandler ¶
type SayServer ¶
type SayServer interface { Hello(context.Context, *Request) (*Response, error) Message(context.Context, *Request) (*Response, error) // contains filtered or unexported methods }
SayServer is the server API for Say service. All implementations must embed UnimplementedSayServer for forward compatibility
type SayService ¶
type SayService interface { Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) Message(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) }
func NewSayService ¶
func NewSayService(name string, c client.Client) SayService
type UnimplementedSayServer ¶
type UnimplementedSayServer struct { }
UnimplementedSayServer must be embedded to have forward compatible implementations.
type UnsafeSayServer ¶
type UnsafeSayServer interface {
// contains filtered or unexported methods
}
UnsafeSayServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SayServer will result in compilation errors.