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",
		20: "VERSION_2",
		3:  "VERSION_3",
	}
	TestVersion_value = map[string]int32{
		"UnKNOW":    0,
		"VERSION_1": 1,
		"VERSION_2": 20,
		"VERSION_3": 3,
	}
)

Enum value maps for TestVersion.

View Source
var File_grpc_test_v3_proto protoreflect.FileDescriptor
View Source
var GrpcTestV3_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc_test.v3.GrpcTestV3",
	HandlerType: (*GrpcTestV3Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Test",
			Handler:    _GrpcTestV3_Test_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc_test_v3.proto",
}

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

Functions

func NewGrpcTestV3Endpoints

func NewGrpcTestV3Endpoints() []*api.Endpoint

func RegisterGrpcTestV3Handler

func RegisterGrpcTestV3Handler(s server.Server, hdlr GrpcTestV3Handler, opts ...server.HandlerOption) error

func RegisterGrpcTestV3Server

func RegisterGrpcTestV3Server(s grpc.ServiceRegistrar, srv GrpcTestV3Server)

Types

type GrpcTestV3Client

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

GrpcTestV3Client is the client API for GrpcTestV3 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 NewGrpcTestV3Client

func NewGrpcTestV3Client(cc grpc.ClientConnInterface) GrpcTestV3Client

type GrpcTestV3Handler

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

type GrpcTestV3Server

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

GrpcTestV3Server is the server API for GrpcTestV3 service. All implementations must embed UnimplementedGrpcTestV3Server for forward compatibility

type GrpcTestV3Service

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

func NewGrpcTestV3Service

func NewGrpcTestV3Service(name string, c client.Client) GrpcTestV3Service

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"`
	// 身高(V2版本新增)
	Height float64 `protobuf:"fixed64,3,opt,name=height,proto3" json:"height,omitempty"`
	// 体重(V3版本修改序号)
	Weight float32 `protobuf:"fixed32,4,opt,name=weight,proto3" json:"weight,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) GetHeight

func (x *Request) GetHeight() float64

func (*Request) GetName

func (x *Request) GetName() string

func (*Request) GetWeight

func (x *Request) GetWeight() float32

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.v3.TestVersion" json:"version,omitempty"`
	// 状态码
	Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
	// 身高(V3版本交换序号)
	Height float64 `protobuf:"fixed64,4,opt,name=height,proto3" json:"height,omitempty"`
	// 体重(V3版本交换序号)
	Weight float32 `protobuf:"fixed32,3,opt,name=weight,proto3" json:"weight,omitempty"`
	// 数据集(V2版本交换字段位置)
	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) GetHeight

func (x *Response) GetHeight() float64

func (*Response) GetVersion

func (x *Response) GetVersion() TestVersion

func (*Response) GetWeight

func (x *Response) GetWeight() float32

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
	// 版本2(V2版本新增)
	TestVersion_VERSION_2 TestVersion = 20
	// 版本3(V3版本新增)
	TestVersion_VERSION_3 TestVersion = 3
)

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 UnimplementedGrpcTestV3Server

type UnimplementedGrpcTestV3Server struct {
}

UnimplementedGrpcTestV3Server must be embedded to have forward compatible implementations.

func (UnimplementedGrpcTestV3Server) Test

type UnsafeGrpcTestV3Server

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

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

Jump to

Keyboard shortcuts

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