testpb

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package testpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ExampleHelloService_SayHello_FullMethodName = "/testpb.ExampleHelloService/SayHello"
)

Variables

View Source
var ExampleHelloService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "testpb.ExampleHelloService",
	HandlerType: (*ExampleHelloServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _ExampleHelloService_SayHello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "test.proto",
}

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

Functions

func RegisterExampleHelloServiceHandler

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

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

func RegisterExampleHelloServiceHandlerClient

func RegisterExampleHelloServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleHelloServiceClient) error

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

func RegisterExampleHelloServiceHandlerFromEndpoint

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

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

func RegisterExampleHelloServiceHandlerServer

func RegisterExampleHelloServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleHelloServiceServer) error

RegisterExampleHelloServiceHandlerServer registers the http handlers for service ExampleHelloService to "mux". UnaryRPC :call ExampleHelloServiceServer 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 RegisterExampleHelloServiceHandlerFromEndpoint instead.

func RegisterExampleHelloServiceServer

func RegisterExampleHelloServiceServer(s grpc.ServiceRegistrar, srv ExampleHelloServiceServer)

Types

type ExampleHelloServiceClient

type ExampleHelloServiceClient interface {
	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
}

ExampleHelloServiceClient is the client API for ExampleHelloService 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 ExampleHelloServiceServer

type ExampleHelloServiceServer interface {
	SayHello(context.Context, *HelloRequest) (*HelloResponse, error)
	// contains filtered or unexported methods
}

ExampleHelloServiceServer is the server API for ExampleHelloService service. All implementations must embed UnimplementedExampleHelloServiceServer for forward compatibility

type HelloRequest

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

func (*HelloRequest) Descriptor deprecated

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

Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.

func (*HelloRequest) GetName

func (x *HelloRequest) GetName() 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 {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloResponse) Descriptor deprecated

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

Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.

func (*HelloResponse) GetMessage

func (x *HelloResponse) GetMessage() string

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 UnimplementedExampleHelloServiceServer

type UnimplementedExampleHelloServiceServer struct {
}

UnimplementedExampleHelloServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedExampleHelloServiceServer) SayHello

type UnsafeExampleHelloServiceServer

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

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

Jump to

Keyboard shortcuts

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