grpc_test

package
v0.0.0-...-f7bef88 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestVersion_name = map[int32]string{
		0: "UnKNOW",
		1: "VERSION_1",
	}
	TestVersion_value = map[string]int32{
		"UnKNOW":    0,
		"VERSION_1": 1,
	}
)

Enum value maps for TestVersion.

View Source
var File_grpc_test_proto protoreflect.FileDescriptor
View Source
var GrpcTest_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc_test.v1.GrpcTest",
	HandlerType: (*GrpcTestServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Test",
			Handler:    _GrpcTest_Test_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc_test_v3.proto",
}

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

Functions

func NewGrpcTestEndpoints

func NewGrpcTestEndpoints() []*api.Endpoint

func RegisterGrpcTestHandler

func RegisterGrpcTestHandler(s server.Server, hdlr GrpcTestHandler, opts ...server.HandlerOption) error

func RegisterGrpcTestServer

func RegisterGrpcTestServer(s grpc.ServiceRegistrar, srv GrpcTestServer)

Types

type GrpcTestClient

type GrpcTestClient interface {
	Test(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

GrpcTestClient is the client API for GrpcTest 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 NewGrpcTestClient

func NewGrpcTestClient(cc grpc.ClientConnInterface) GrpcTestClient

type GrpcTestHandler

type GrpcTestHandler interface {
	Test(context.Context, *Request, *Response) error
}

type GrpcTestServer

type GrpcTestServer interface {
	Test(context.Context, *Request) (*Response, error)
	// contains filtered or unexported methods
}

GrpcTestServer is the server API for GrpcTest service. All implementations must embed UnimplementedGrpcTestServer for forward compatibility

type GrpcTestService

type GrpcTestService interface {
	Test(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
}

func NewGrpcTestService

func NewGrpcTestService(name string, c client.Client) GrpcTestService

type Request

type Request struct {

	// 姓名
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// 年龄
	Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	// 其他参数
	Others []byte `protobuf:"bytes,100,opt,name=others,proto3" json:"others,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetAge

func (x *Request) GetAge() int32

func (*Request) GetName

func (x *Request) GetName() string

func (*Request) GetOthers

func (x *Request) GetOthers() []byte

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

func (*Request) Validate

func (m *Request) Validate() error

Validate checks the field values on Request with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Request) ValidateAll

func (m *Request) ValidateAll() error

ValidateAll checks the field values on Request with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RequestMultiError, or nil if none found.

type RequestMultiError

type RequestMultiError []error

RequestMultiError is an error wrapping multiple validation errors returned by Request.ValidateAll() if the designated constraints aren't met.

func (RequestMultiError) AllErrors

func (m RequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RequestMultiError) Error

func (m RequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RequestValidationError

type RequestValidationError struct {
	// contains filtered or unexported fields
}

RequestValidationError is the validation error returned by Request.Validate if the designated constraints aren't met.

func (RequestValidationError) Cause

func (e RequestValidationError) Cause() error

Cause function returns cause value.

func (RequestValidationError) Error

func (e RequestValidationError) Error() string

Error satisfies the builtin error interface

func (RequestValidationError) ErrorName

func (e RequestValidationError) ErrorName() string

ErrorName returns error name.

func (RequestValidationError) Field

func (e RequestValidationError) Field() string

Field function returns field value.

func (RequestValidationError) Key

func (e RequestValidationError) Key() bool

Key function returns key value.

func (RequestValidationError) Reason

func (e RequestValidationError) Reason() string

Reason function returns reason value.

type Response

type Response struct {

	// 当前版本
	Version TestVersion `protobuf:"varint,1,opt,name=version,proto3,enum=grpc_test.v1.TestVersion" json:"version,omitempty"`
	// 状态码
	Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
	// 数据集
	Data map[string]string `` /* 149-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() int32

func (*Response) GetData

func (x *Response) GetData() map[string]string

func (*Response) GetVersion

func (x *Response) GetVersion() TestVersion

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

func (*Response) Validate

func (m *Response) Validate() error

Validate checks the field values on Response with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Response) ValidateAll

func (m *Response) ValidateAll() error

ValidateAll checks the field values on Response with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ResponseMultiError, or nil if none found.

type ResponseMultiError

type ResponseMultiError []error

ResponseMultiError is an error wrapping multiple validation errors returned by Response.ValidateAll() if the designated constraints aren't met.

func (ResponseMultiError) AllErrors

func (m ResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ResponseMultiError) Error

func (m ResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ResponseValidationError

type ResponseValidationError struct {
	// contains filtered or unexported fields
}

ResponseValidationError is the validation error returned by Response.Validate if the designated constraints aren't met.

func (ResponseValidationError) Cause

func (e ResponseValidationError) Cause() error

Cause function returns cause value.

func (ResponseValidationError) Error

func (e ResponseValidationError) Error() string

Error satisfies the builtin error interface

func (ResponseValidationError) ErrorName

func (e ResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ResponseValidationError) Field

func (e ResponseValidationError) Field() string

Field function returns field value.

func (ResponseValidationError) Key

func (e ResponseValidationError) Key() bool

Key function returns key value.

func (ResponseValidationError) Reason

func (e ResponseValidationError) Reason() string

Reason function returns reason value.

type TestVersion

type TestVersion int32
const (
	// 未知版本
	TestVersion_UnKNOW TestVersion = 0
	// 版本1
	TestVersion_VERSION_1 TestVersion = 1
)

func (TestVersion) Descriptor

func (TestVersion) Enum

func (x TestVersion) Enum() *TestVersion

func (TestVersion) EnumDescriptor deprecated

func (TestVersion) EnumDescriptor() ([]byte, []int)

Deprecated: Use TestVersion.Descriptor instead.

func (TestVersion) Number

func (x TestVersion) Number() protoreflect.EnumNumber

func (TestVersion) String

func (x TestVersion) String() string

func (TestVersion) Type

type UnimplementedGrpcTestServer

type UnimplementedGrpcTestServer struct {
}

UnimplementedGrpcTestServer must be embedded to have forward compatible implementations.

func (UnimplementedGrpcTestServer) Test

type UnsafeGrpcTestServer

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

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

Jump to

Keyboard shortcuts

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