Documentation ¶
Index ¶
- Variables
- func NewGrpcTestV3Endpoints() []*api.Endpoint
- func RegisterGrpcTestV3Handler(s server.Server, hdlr GrpcTestV3Handler, opts ...server.HandlerOption) error
- func RegisterGrpcTestV3Server(s grpc.ServiceRegistrar, srv GrpcTestV3Server)
- type GrpcTestV3Client
- type GrpcTestV3Handler
- type GrpcTestV3Server
- type GrpcTestV3Service
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetAge() int32
- func (x *Request) GetHeight() float64
- func (x *Request) GetName() string
- func (x *Request) GetWeight() float32
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- func (m *Request) Validate() error
- func (m *Request) ValidateAll() error
- type RequestMultiError
- type RequestValidationError
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetCode() int32
- func (x *Response) GetData() map[string]string
- func (x *Response) GetHeight() float64
- func (x *Response) GetVersion() TestVersion
- func (x *Response) GetWeight() float32
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- func (m *Response) Validate() error
- func (m *Response) ValidateAll() error
- type ResponseMultiError
- type ResponseValidationError
- type TestVersion
- func (TestVersion) Descriptor() protoreflect.EnumDescriptor
- func (x TestVersion) Enum() *TestVersion
- func (TestVersion) EnumDescriptor() ([]byte, []int)deprecated
- func (x TestVersion) Number() protoreflect.EnumNumber
- func (x TestVersion) String() string
- func (TestVersion) Type() protoreflect.EnumType
- type UnimplementedGrpcTestV3Server
- type UnsafeGrpcTestV3Server
Constants ¶
This section is empty.
Variables ¶
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.
var File_grpc_test_v3_proto protoreflect.FileDescriptor
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 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 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) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
func (*Request) Validate ¶
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 ¶
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) GetVersion ¶
func (x *Response) GetVersion() TestVersion
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
func (*Response) Validate ¶
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 ¶
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) Descriptor() protoreflect.EnumDescriptor
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 ¶
func (TestVersion) Type() protoreflect.EnumType
type UnimplementedGrpcTestV3Server ¶
type UnimplementedGrpcTestV3Server struct { }
UnimplementedGrpcTestV3Server must be embedded to have forward compatible implementations.
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.