Documentation ¶
Index ¶
- Variables
- func NewGrpcTestEndpoints() []*api.Endpoint
- func RegisterGrpcTestHandler(s server.Server, hdlr GrpcTestHandler, opts ...server.HandlerOption) error
- func RegisterGrpcTestServer(s grpc.ServiceRegistrar, srv GrpcTestServer)
- type GrpcTestClient
- type GrpcTestHandler
- type GrpcTestServer
- type GrpcTestService
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetAge() int32
- func (x *Request) GetName() string
- func (x *Request) GetOthers() []byte
- 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) GetVersion() TestVersion
- 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 UnimplementedGrpcTestServer
- type UnsafeGrpcTestServer
Constants ¶
This section is empty.
Variables ¶
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.
var File_grpc_test_proto protoreflect.FileDescriptor
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 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 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) 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.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) 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 )
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 UnimplementedGrpcTestServer ¶
type UnimplementedGrpcTestServer struct { }
UnimplementedGrpcTestServer must be embedded to have forward compatible implementations.
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.