hello

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package hello is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Say_Hello_FullMethodName   = "/greeter.Say/Hello"
	Say_Message_FullMethodName = "/greeter.Say/Message"
)

Variables

View Source
var File_hello_hello_proto protoreflect.FileDescriptor
View Source
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 NewSayEndpoints() []*api.Endpoint

func RegisterSayHandler

func RegisterSayHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSayHandler registers the http handlers for service Say to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSayHandlerClient

func RegisterSayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SayClient) error

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

func RegisterSayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SayServer) error

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetName

func (x *Request) GetName() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetMsg

func (x *Response) GetMsg() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

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 SayHandler interface {
	Hello(context.Context, *Request, *Response) error
	Message(context.Context, *Request, *Response) error
}

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.

func (UnimplementedSayServer) Hello

func (UnimplementedSayServer) Message

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.

Jump to

Keyboard shortcuts

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