example

package
v0.0.0-...-325bc79 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_example_server_proto protoreflect.FileDescriptor
View Source
var MyService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "MyService",
	HandlerType: (*MyServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "MyMethod",
			Handler:    _MyService_MyMethod_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/example/server.proto",
}

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

View Source
var Test_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Test",
	HandlerType: (*TestServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "MyMethod",
			Handler:    _Test_MyMethod_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/example/server.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 MyServiceContractTest

func MyServiceContractTest(t *testing.T, ctx context.Context, server *grpc.Server)

func RegisterMyServiceServer

func RegisterMyServiceServer(s grpc.ServiceRegistrar, srv MyServiceServer)

func RegisterTestServer

func RegisterTestServer(s grpc.ServiceRegistrar, srv TestServer)

Types

type MyServiceClient

type MyServiceClient interface {
	MyMethod(ctx context.Context, in *RequestMessage, opts ...grpc.CallOption) (*ResponseMessage, error)
}

MyServiceClient is the client API for MyService 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 NewMyServiceClient

func NewMyServiceClient(cc grpc.ClientConnInterface) MyServiceClient

type MyServiceContractClient

type MyServiceContractClient struct{}

func (MyServiceContractClient) MyMethod

type MyServiceServer

type MyServiceServer interface {
	MyMethod(context.Context, *RequestMessage) (*ResponseMessage, error)
	// contains filtered or unexported methods
}

MyServiceServer is the server API for MyService service. All implementations must embed UnimplementedMyServiceServer for forward compatibility

type MyServiceStubServer

type MyServiceStubServer struct {
	UnimplementedMyServiceServer
}

func (MyServiceStubServer) MyMethod

type RequestMessage

type RequestMessage struct {
	RequestField string           `protobuf:"bytes,1,opt,name=requestField,proto3" json:"requestField,omitempty"`
	AnotherField *structpb.Struct `protobuf:"bytes,2,opt,name=anotherField,proto3" json:"anotherField,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestMessage) Descriptor deprecated

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

Deprecated: Use RequestMessage.ProtoReflect.Descriptor instead.

func (*RequestMessage) GetAnotherField

func (x *RequestMessage) GetAnotherField() *structpb.Struct

func (*RequestMessage) GetRequestField

func (x *RequestMessage) GetRequestField() string

func (*RequestMessage) ProtoMessage

func (*RequestMessage) ProtoMessage()

func (*RequestMessage) ProtoReflect

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

func (*RequestMessage) Reset

func (x *RequestMessage) Reset()

func (*RequestMessage) String

func (x *RequestMessage) String() string

type ResponseMessage

type ResponseMessage struct {
	ResponseField int64 `protobuf:"varint,1,opt,name=responseField,proto3" json:"responseField,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseMessage) Descriptor deprecated

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

Deprecated: Use ResponseMessage.ProtoReflect.Descriptor instead.

func (*ResponseMessage) GetResponseField

func (x *ResponseMessage) GetResponseField() int64

func (*ResponseMessage) ProtoMessage

func (*ResponseMessage) ProtoMessage()

func (*ResponseMessage) ProtoReflect

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

func (*ResponseMessage) Reset

func (x *ResponseMessage) Reset()

func (*ResponseMessage) String

func (x *ResponseMessage) String() string

type TestClient

type TestClient interface {
	MyMethod(ctx context.Context, in *RequestMessage, opts ...grpc.CallOption) (*ResponseMessage, 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 {
	MyMethod(context.Context, *RequestMessage) (*ResponseMessage, error)
	// contains filtered or unexported methods
}

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

type UnimplementedMyServiceServer

type UnimplementedMyServiceServer struct {
}

UnimplementedMyServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedMyServiceServer) MyMethod

type UnimplementedTestServer

type UnimplementedTestServer struct {
}

UnimplementedTestServer must be embedded to have forward compatible implementations.

func (UnimplementedTestServer) MyMethod

type UnsafeMyServiceServer

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

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

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