hello

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package hello is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	MagicNumber_name = map[int32]string{
		0: "MAGICNUMBER_UNSPECIFIED",
		1: "ONE",
		2: "TWO",
	}
	MagicNumber_value = map[string]int32{
		"MAGICNUMBER_UNSPECIFIED": 0,
		"ONE":                     1,
		"TWO":                     2,
	}
)

Enum value maps for MagicNumber.

View Source
var File_hello_proto protoreflect.FileDescriptor
View Source
var Hello_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.Hello",
	HandlerType: (*HelloServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHi",
			Handler:    _Hello_SayHi_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "hello.proto",
}

Hello_ServiceDesc is the grpc.ServiceDesc for Hello service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHelloHandler

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

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

func RegisterHelloHandlerClient

func RegisterHelloHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloClient) error

RegisterHelloHandlerClient registers the http handlers for service Hello to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HelloClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HelloClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HelloClient" to call the correct interceptors.

func RegisterHelloHandlerFromEndpoint

func RegisterHelloHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHelloHandlerFromEndpoint is same as RegisterHelloHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHelloHandlerServer

func RegisterHelloHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloServer) error

RegisterHelloHandlerServer registers the http handlers for service Hello to "mux". UnaryRPC :call HelloServer 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 RegisterHelloHandlerFromEndpoint instead.

func RegisterHelloServer

func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer)

Types

type HelloClient

type HelloClient interface {
	SayHi(ctx context.Context, in *SayHiRequest, opts ...grpc.CallOption) (*SayHiResponse, error)
}

HelloClient is the client API for Hello 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 NewHelloClient

func NewHelloClient(cc grpc.ClientConnInterface) HelloClient

type HelloServer

type HelloServer interface {
	SayHi(context.Context, *SayHiRequest) (*SayHiResponse, error)
	// contains filtered or unexported methods
}

HelloServer is the server API for Hello service. All implementations must embed UnimplementedHelloServer for forward compatibility

type MagicNumber

type MagicNumber int32
const (
	MagicNumber_MAGICNUMBER_UNSPECIFIED MagicNumber = 0
	MagicNumber_ONE                     MagicNumber = 1
	MagicNumber_TWO                     MagicNumber = 2
)

func (MagicNumber) Descriptor

func (MagicNumber) Enum

func (x MagicNumber) Enum() *MagicNumber

func (MagicNumber) EnumDescriptor deprecated

func (MagicNumber) EnumDescriptor() ([]byte, []int)

Deprecated: Use MagicNumber.Descriptor instead.

func (MagicNumber) Number

func (x MagicNumber) Number() protoreflect.EnumNumber

func (MagicNumber) String

func (x MagicNumber) String() string

func (MagicNumber) Type

type SayHiRequest

type SayHiRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*SayHiRequest) Descriptor deprecated

func (*SayHiRequest) Descriptor() ([]byte, []int)

Deprecated: Use SayHiRequest.ProtoReflect.Descriptor instead.

func (*SayHiRequest) GetName

func (x *SayHiRequest) GetName() string

func (*SayHiRequest) ProtoMessage

func (*SayHiRequest) ProtoMessage()

func (*SayHiRequest) ProtoReflect

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

func (*SayHiRequest) Reset

func (x *SayHiRequest) Reset()

func (*SayHiRequest) String

func (x *SayHiRequest) String() string

type SayHiResponse

type SayHiResponse struct {
	Text        string      `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	MagicNumber int32       `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"`
	Number      MagicNumber `protobuf:"varint,3,opt,name=number,proto3,enum=hello.MagicNumber" json:"number,omitempty"`
	// contains filtered or unexported fields
}

func (*SayHiResponse) Descriptor deprecated

func (*SayHiResponse) Descriptor() ([]byte, []int)

Deprecated: Use SayHiResponse.ProtoReflect.Descriptor instead.

func (*SayHiResponse) GetMagicNumber

func (x *SayHiResponse) GetMagicNumber() int32

func (*SayHiResponse) GetNumber

func (x *SayHiResponse) GetNumber() MagicNumber

func (*SayHiResponse) GetText

func (x *SayHiResponse) GetText() string

func (*SayHiResponse) ProtoMessage

func (*SayHiResponse) ProtoMessage()

func (*SayHiResponse) ProtoReflect

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

func (*SayHiResponse) Reset

func (x *SayHiResponse) Reset()

func (*SayHiResponse) String

func (x *SayHiResponse) String() string

type UnimplementedHelloServer

type UnimplementedHelloServer struct {
}

UnimplementedHelloServer must be embedded to have forward compatible implementations.

func (UnimplementedHelloServer) SayHi

type UnsafeHelloServer

type UnsafeHelloServer interface {
	// contains filtered or unexported methods
}

UnsafeHelloServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HelloServer will result in compilation errors.

Jump to

Keyboard shortcuts

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