hellov1

package
v0.0.0-...-86e5a5c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package hellov1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_v1_hello_proto protoreflect.FileDescriptor
View Source
var HelloService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.v1.HelloService",
	HandlerType: (*HelloServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ShowAllHellos",
			Handler:    _HelloService_ShowAllHellos_Handler,
		},
		{
			MethodName: "SayHello",
			Handler:    _HelloService_SayHello_Handler,
		},
		{
			MethodName: "SayCustomHello",
			Handler:    _HelloService_SayCustomHello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/hello.proto",
}

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

Functions

func RegisterHelloServiceHandler

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

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

func RegisterHelloServiceHandlerClient

func RegisterHelloServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloServiceClient) error

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

func RegisterHelloServiceHandlerFromEndpoint

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

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

func RegisterHelloServiceHandlerServer

func RegisterHelloServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloServiceServer) error

RegisterHelloServiceHandlerServer registers the http handlers for service HelloService to "mux". UnaryRPC :call HelloServiceServer 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 RegisterHelloServiceHandlerFromEndpoint instead.

func RegisterHelloServiceServer

func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer)

Types

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

protobuf doesn't allow specifying nothing so we define a message with nothing in it

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type HelloRequest

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

hello message with a custom word

func (*HelloRequest) Descriptor deprecated

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

Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.

func (*HelloRequest) GetCustomWord

func (x *HelloRequest) GetCustomWord() string

func (*HelloRequest) ProtoMessage

func (*HelloRequest) ProtoMessage()

func (*HelloRequest) ProtoReflect

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

func (*HelloRequest) Reset

func (x *HelloRequest) Reset()

func (*HelloRequest) String

func (x *HelloRequest) String() string

type HelloResponse

type HelloResponse struct {
	HelloWord string `protobuf:"bytes,1,opt,name=hello_word,json=helloWord,proto3" json:"hello_word,omitempty"`
	Id        uint32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

hello message with the full hello phrase

func (*HelloResponse) Descriptor deprecated

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

Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.

func (*HelloResponse) GetHelloWord

func (x *HelloResponse) GetHelloWord() string

func (*HelloResponse) GetId

func (x *HelloResponse) GetId() uint32

func (*HelloResponse) ProtoMessage

func (*HelloResponse) ProtoMessage()

func (*HelloResponse) ProtoReflect

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

func (*HelloResponse) Reset

func (x *HelloResponse) Reset()

func (*HelloResponse) String

func (x *HelloResponse) String() string

type HelloServiceClient

type HelloServiceClient interface {
	// showallhellos which should return a list of all hellos
	ShowAllHellos(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HellosResponse, error)
	// sayhello which should return the phrase hello world
	SayHello(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HelloResponse, error)
	// saycustomhello which should return the phrase hello and a custom word
	SayCustomHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
}

HelloServiceClient is the client API for HelloService 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 HelloServiceServer

type HelloServiceServer interface {
	// showallhellos which should return a list of all hellos
	ShowAllHellos(context.Context, *Empty) (*HellosResponse, error)
	// sayhello which should return the phrase hello world
	SayHello(context.Context, *Empty) (*HelloResponse, error)
	// saycustomhello which should return the phrase hello and a custom word
	SayCustomHello(context.Context, *HelloRequest) (*HelloResponse, error)
	// contains filtered or unexported methods
}

HelloServiceServer is the server API for HelloService service. All implementations must embed UnimplementedHelloServiceServer for forward compatibility

type HellosResponse

type HellosResponse struct {
	Hellos []*HelloResponse `protobuf:"bytes,1,rep,name=hellos,proto3" json:"hellos,omitempty"`
	// contains filtered or unexported fields
}

list of all hellos

func (*HellosResponse) Descriptor deprecated

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

Deprecated: Use HellosResponse.ProtoReflect.Descriptor instead.

func (*HellosResponse) GetHellos

func (x *HellosResponse) GetHellos() []*HelloResponse

func (*HellosResponse) ProtoMessage

func (*HellosResponse) ProtoMessage()

func (*HellosResponse) ProtoReflect

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

func (*HellosResponse) Reset

func (x *HellosResponse) Reset()

func (*HellosResponse) String

func (x *HellosResponse) String() string

type UnimplementedHelloServiceServer

type UnimplementedHelloServiceServer struct {
}

UnimplementedHelloServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedHelloServiceServer) SayCustomHello

func (UnimplementedHelloServiceServer) SayHello

func (UnimplementedHelloServiceServer) ShowAllHellos

type UnsafeHelloServiceServer

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

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

Jump to

Keyboard shortcuts

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