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

Enum value maps for TestVersion.

View Source
var File_grpc_test_v2_proto protoreflect.FileDescriptor
View Source
var GrpcTestV2_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc_test.v2.GrpcTestV2",
	HandlerType: (*GrpcTestV2Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Test",
			Handler:    _GrpcTestV2_Test_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc_test_v2.proto",
}

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

Functions

func NewGrpcTestV2Endpoints

func NewGrpcTestV2Endpoints() []*api.Endpoint

func RegisterGrpcTestV2Handler

func RegisterGrpcTestV2Handler(s server.Server, hdlr GrpcTestV2Handler, opts ...server.HandlerOption) error

func RegisterGrpcTestV2Server

func RegisterGrpcTestV2Server(s grpc.ServiceRegistrar, srv GrpcTestV2Server)

Types

type GrpcTestV2Client

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

GrpcTestV2Client is the client API for GrpcTestV2 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 NewGrpcTestV2Client

func NewGrpcTestV2Client(cc grpc.ClientConnInterface) GrpcTestV2Client

type GrpcTestV2Handler

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

type GrpcTestV2Server

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

GrpcTestV2Server is the server API for GrpcTestV2 service. All implementations must embed UnimplementedGrpcTestV2Server for forward compatibility

type GrpcTestV2Service

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

func NewGrpcTestV2Service

func NewGrpcTestV2Service(name string, c client.Client) GrpcTestV2Service

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"`
	// 其他参数(V2版本弃用)
	//
	// Deprecated: Do not use.
	Others []byte `protobuf:"bytes,100,opt,name=others,proto3" json:"others,omitempty"`
	// 体重(V2版本新增)
	Weight float32 `protobuf:"fixed32,5,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) GetOthers deprecated

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

Deprecated: Do not use.

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

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 UnimplementedGrpcTestV2Server

type UnimplementedGrpcTestV2Server struct {
}

UnimplementedGrpcTestV2Server must be embedded to have forward compatible implementations.

func (UnimplementedGrpcTestV2Server) Test

type UnsafeGrpcTestV2Server

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

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

Jump to

Keyboard shortcuts

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