testproto

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package testproto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthService        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowService          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group")
)

Functions

func InMemoryClientConn

func InMemoryClientConn(t *testing.T, grpcSrv *grpc.Server) *grpc.ClientConn

InMemoryClientConn creates a grpc client connection to a grpc server which is listening on a random port.

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 grpc1.Server, srv TestServer)

Types

type TestClient

type TestClient interface {
	Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error)
}

TestClient is the client API for Test service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTestClient

func NewTestClient(cc grpc1.ClientConn) TestClient

type TestRequest

type TestRequest struct {
	Request string `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
}

func (*TestRequest) Descriptor

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

func (*TestRequest) GetRequest

func (m *TestRequest) GetRequest() string

func (*TestRequest) Marshal

func (m *TestRequest) Marshal() (dAtA []byte, err error)

func (*TestRequest) MarshalTo

func (m *TestRequest) MarshalTo(dAtA []byte) (int, error)

func (*TestRequest) MarshalToSizedBuffer

func (m *TestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestRequest) ProtoMessage

func (*TestRequest) ProtoMessage()

func (*TestRequest) Reset

func (m *TestRequest) Reset()

func (*TestRequest) Size

func (m *TestRequest) Size() (n int)

func (*TestRequest) String

func (m *TestRequest) String() string

func (*TestRequest) Unmarshal

func (m *TestRequest) Unmarshal(dAtA []byte) error

func (*TestRequest) XXX_DiscardUnknown

func (m *TestRequest) XXX_DiscardUnknown()

func (*TestRequest) XXX_Marshal

func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestRequest) XXX_Merge

func (m *TestRequest) XXX_Merge(src proto.Message)

func (*TestRequest) XXX_Size

func (m *TestRequest) XXX_Size() int

func (*TestRequest) XXX_Unmarshal

func (m *TestRequest) XXX_Unmarshal(b []byte) error

type TestResponse

type TestResponse struct {
	Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
}

func (*TestResponse) Descriptor

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

func (*TestResponse) GetResponse

func (m *TestResponse) GetResponse() string

func (*TestResponse) Marshal

func (m *TestResponse) Marshal() (dAtA []byte, err error)

func (*TestResponse) MarshalTo

func (m *TestResponse) MarshalTo(dAtA []byte) (int, error)

func (*TestResponse) MarshalToSizedBuffer

func (m *TestResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestResponse) ProtoMessage

func (*TestResponse) ProtoMessage()

func (*TestResponse) Reset

func (m *TestResponse) Reset()

func (*TestResponse) Size

func (m *TestResponse) Size() (n int)

func (*TestResponse) String

func (m *TestResponse) String() string

func (*TestResponse) Unmarshal

func (m *TestResponse) Unmarshal(dAtA []byte) error

func (*TestResponse) XXX_DiscardUnknown

func (m *TestResponse) XXX_DiscardUnknown()

func (*TestResponse) XXX_Marshal

func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestResponse) XXX_Merge

func (m *TestResponse) XXX_Merge(src proto.Message)

func (*TestResponse) XXX_Size

func (m *TestResponse) XXX_Size() int

func (*TestResponse) XXX_Unmarshal

func (m *TestResponse) XXX_Unmarshal(b []byte) error

type TestServer

type TestServer interface {
	Test(context.Context, *TestRequest) (*TestResponse, error)
}

TestServer is the server API for Test service.

type UnimplementedTestServer

type UnimplementedTestServer struct {
}

UnimplementedTestServer can be embedded to have forward compatible implementations.

func (*UnimplementedTestServer) Test

Jump to

Keyboard shortcuts

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