test

package
v0.0.0-...-682624e Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package test is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_server_test_proto protoreflect.FileDescriptor
View Source
var Test_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Test",
	HandlerType: (*TestServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Greeting",
			Handler:    _Test_Greeting_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "server/test.proto",
}

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

Functions

func RegisterTestHandler

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

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

func RegisterTestHandlerClient

func RegisterTestHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestClient) error

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

func RegisterTestHandlerFromEndpoint

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

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

func RegisterTestHandlerServer

func RegisterTestHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServer) error

RegisterTestHandlerServer registers the http handlers for service Test to "mux". UnaryRPC :call TestServer 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 RegisterTestHandlerFromEndpoint instead.

func RegisterTestServer

func RegisterTestServer(s grpc.ServiceRegistrar, srv TestServer)

Types

type GreetingRequest

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

func (*GreetingRequest) Descriptor deprecated

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

Deprecated: Use GreetingRequest.ProtoReflect.Descriptor instead.

func (*GreetingRequest) GetName

func (x *GreetingRequest) GetName() string

func (*GreetingRequest) ProtoMessage

func (*GreetingRequest) ProtoMessage()

func (*GreetingRequest) ProtoReflect

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

func (*GreetingRequest) Reset

func (x *GreetingRequest) Reset()

func (*GreetingRequest) String

func (x *GreetingRequest) String() string

type GreetingResponse

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

func (*GreetingResponse) Descriptor deprecated

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

Deprecated: Use GreetingResponse.ProtoReflect.Descriptor instead.

func (*GreetingResponse) GetMessage

func (x *GreetingResponse) GetMessage() string

func (*GreetingResponse) ProtoMessage

func (*GreetingResponse) ProtoMessage()

func (*GreetingResponse) ProtoReflect

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

func (*GreetingResponse) Reset

func (x *GreetingResponse) Reset()

func (*GreetingResponse) String

func (x *GreetingResponse) String() string

type TestClient

type TestClient interface {
	Greeting(ctx context.Context, in *GreetingRequest, opts ...grpc.CallOption) (*GreetingResponse, error)
}

TestClient is the client API for Test 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 NewTestClient

func NewTestClient(cc grpc.ClientConnInterface) TestClient

type TestServer

type TestServer interface {
	Greeting(context.Context, *GreetingRequest) (*GreetingResponse, error)
	// contains filtered or unexported methods
}

TestServer is the server API for Test service. All implementations must embed UnimplementedTestServer for forward compatibility

type UnimplementedTestServer

type UnimplementedTestServer struct {
}

UnimplementedTestServer must be embedded to have forward compatible implementations.

func (UnimplementedTestServer) Greeting

type UnsafeTestServer

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

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

Jump to

Keyboard shortcuts

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