Documentation ¶
Overview ¶
Package tspb contains a mock of gRPC service for testing purposes.
Index ¶
- Constants
- Variables
- func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
- func Run(t *testing.T, ts MockTestService, opts ...grpc.ServerOption) (addr string)
- type MockTestService
- type TestRequest
- type TestResponse
- type TestServiceClient
- type TestServiceServer
- type UnimplementedTestServiceServer
- type UnsafeTestServiceServer
Constants ¶
const (
TestService_Test_FullMethodName = "/com.github.cappuccinotm.gcache.example.TestService/Test"
)
Variables ¶
var File_ts_proto protoreflect.FileDescriptor
var TestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "com.github.cappuccinotm.gcache.example.TestService", HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Test", Handler: _TestService_Test_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "ts.proto", }
TestService_ServiceDesc is the grpc.ServiceDesc for TestService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterTestServiceServer ¶
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
func Run ¶
func Run(t *testing.T, ts MockTestService, opts ...grpc.ServerOption) (addr string)
Run runs test server.
Types ¶
type MockTestService ¶
type MockTestService struct { TestFunc func(ctx context.Context, in *TestRequest) (*TestResponse, error) UnimplementedTestServiceServer }
MockTestService is a mock for TestServiceServer
func (*MockTestService) Test ¶
func (m *MockTestService) Test(ctx context.Context, in *TestRequest) (*TestResponse, error)
Test implements TestServiceServer
type TestRequest ¶
type TestRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
func (*TestRequest) Descriptor
deprecated
func (*TestRequest) Descriptor() ([]byte, []int)
Deprecated: Use TestRequest.ProtoReflect.Descriptor instead.
func (*TestRequest) GetKey ¶
func (x *TestRequest) GetKey() string
func (*TestRequest) ProtoMessage ¶
func (*TestRequest) ProtoMessage()
func (*TestRequest) ProtoReflect ¶
func (x *TestRequest) ProtoReflect() protoreflect.Message
func (*TestRequest) Reset ¶
func (x *TestRequest) Reset()
func (*TestRequest) String ¶
func (x *TestRequest) String() string
type TestResponse ¶
type TestResponse struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*TestResponse) Descriptor
deprecated
func (*TestResponse) Descriptor() ([]byte, []int)
Deprecated: Use TestResponse.ProtoReflect.Descriptor instead.
func (*TestResponse) GetValue ¶
func (x *TestResponse) GetValue() string
func (*TestResponse) ProtoMessage ¶
func (*TestResponse) ProtoMessage()
func (*TestResponse) ProtoReflect ¶
func (x *TestResponse) ProtoReflect() protoreflect.Message
func (*TestResponse) Reset ¶
func (x *TestResponse) Reset()
func (*TestResponse) String ¶
func (x *TestResponse) String() string
type TestServiceClient ¶
type TestServiceClient interface {
Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error)
}
TestServiceClient is the client API for TestService 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 NewTestServiceClient ¶
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient
type TestServiceServer ¶
type TestServiceServer interface { Test(context.Context, *TestRequest) (*TestResponse, error) // contains filtered or unexported methods }
TestServiceServer is the server API for TestService service. All implementations must embed UnimplementedTestServiceServer for forward compatibility
type UnimplementedTestServiceServer ¶
type UnimplementedTestServiceServer struct { }
UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedTestServiceServer) Test ¶
func (UnimplementedTestServiceServer) Test(context.Context, *TestRequest) (*TestResponse, error)
type UnsafeTestServiceServer ¶
type UnsafeTestServiceServer interface {
// contains filtered or unexported methods
}
UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TestServiceServer will result in compilation errors.