Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer)
- func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
- type ErrorReason
- func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
- func (x ErrorReason) Enum() *ErrorReason
- func (ErrorReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x ErrorReason) Number() protoreflect.EnumNumber
- func (x ErrorReason) String() string
- func (ErrorReason) Type() protoreflect.EnumType
- type GreeterClient
- type GreeterHTTPClient
- type GreeterHTTPClientImpl
- type GreeterHTTPServer
- type GreeterServer
- type HelloReply
- type HelloRequest
- type UnimplementedGreeterServer
- type UnsafeGreeterServer
Constants ¶
const OperationGreeterSayHello = "/helloworld.v1.Greeter/SayHello"
Variables ¶
var ( ErrorReason_name = map[int32]string{ 0: "UnSpecified", -1: "UNKNOWN", 4: "PERMISSION_ERROR", 5: "SERVICE_ERROR", 91: "RETCODE_NOT_REGIST", 100: "VERIFY_FAIL", 110: "TIME_OUT", 120: "DATA_FAIL", 140: "USER_PERMISSIONS", 150: "SERVICE_UNAVAILABLE", 153: "RATELIMIT", 154: "CIRCUITBREAKER", 160: "MISSING_ACTION", 170: "MISSING_SIGNATURE", 171: "ERROR_SIGNATURE", 172: "USER_NOT_EXISTS", 180: "MISSING_API_VERSION", 190: "API_VERSION_ERROR", 200: "GET_NAMES_ERROR", 210: "PARAMS_RANGE_ERROR", 220: "MISSING_PARAMS", 221: "VALIDATOR", 230: "PARAMS_ERROR", 231: "CODEC", 250: "LACK_OF_BALANCE", 260: "DEDUCTIONS_ERROR", 270: "SETTLEMENT_ERROR", 280: "NO_ACTIVE_BACKEND_ERROR", } ErrorReason_value = map[string]int32{ "UnSpecified": 0, "UNKNOWN": -1, "PERMISSION_ERROR": 4, "SERVICE_ERROR": 5, "RETCODE_NOT_REGIST": 91, "VERIFY_FAIL": 100, "TIME_OUT": 110, "DATA_FAIL": 120, "USER_PERMISSIONS": 140, "SERVICE_UNAVAILABLE": 150, "RATELIMIT": 153, "CIRCUITBREAKER": 154, "MISSING_ACTION": 160, "MISSING_SIGNATURE": 170, "ERROR_SIGNATURE": 171, "USER_NOT_EXISTS": 172, "MISSING_API_VERSION": 180, "API_VERSION_ERROR": 190, "GET_NAMES_ERROR": 200, "PARAMS_RANGE_ERROR": 210, "MISSING_PARAMS": 220, "VALIDATOR": 221, "PARAMS_ERROR": 230, "CODEC": 231, "LACK_OF_BALANCE": 250, "DEDUCTIONS_ERROR": 260, "SETTLEMENT_ERROR": 270, "NO_ACTIVE_BACKEND_ERROR": 280, } )
Enum value maps for ErrorReason.
var (
// optional bool as_array = 50002;
E_AsArray = &file_helloworld_v1_greeter_proto_extTypes[0]
)
Extension fields to descriptorpb.FieldOptions.
var (
// optional string uerrreason = 50005;
E_Uerrreason = &file_helloworld_v1_error_reason_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumValueOptions.
var File_helloworld_v1_error_reason_proto protoreflect.FileDescriptor
var File_helloworld_v1_greeter_proto protoreflect.FileDescriptor
var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.v1.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _Greeter_SayHello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "helloworld/v1/greeter.proto", }
Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterGreeterHTTPServer ¶
func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer)
func RegisterGreeterServer ¶
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
Types ¶
type ErrorReason ¶
type ErrorReason int32
const ( // 框架级(通用错误码) ErrorReason_UnSpecified ErrorReason = 0 ErrorReason_UNKNOWN ErrorReason = -1 ErrorReason_PERMISSION_ERROR ErrorReason = 4 ErrorReason_SERVICE_ERROR ErrorReason = 5 ErrorReason_RETCODE_NOT_REGIST ErrorReason = 91 ErrorReason_VERIFY_FAIL ErrorReason = 100 ErrorReason_TIME_OUT ErrorReason = 110 ErrorReason_DATA_FAIL ErrorReason = 120 ErrorReason_USER_PERMISSIONS ErrorReason = 140 ErrorReason_SERVICE_UNAVAILABLE ErrorReason = 150 ErrorReason_RATELIMIT ErrorReason = 153 ErrorReason_CIRCUITBREAKER ErrorReason = 154 ErrorReason_MISSING_ACTION ErrorReason = 160 ErrorReason_MISSING_SIGNATURE ErrorReason = 170 ErrorReason_ERROR_SIGNATURE ErrorReason = 171 ErrorReason_USER_NOT_EXISTS ErrorReason = 172 ErrorReason_MISSING_API_VERSION ErrorReason = 180 ErrorReason_API_VERSION_ERROR ErrorReason = 190 ErrorReason_GET_NAMES_ERROR ErrorReason = 200 ErrorReason_PARAMS_RANGE_ERROR ErrorReason = 210 ErrorReason_MISSING_PARAMS ErrorReason = 220 ErrorReason_VALIDATOR ErrorReason = 221 ErrorReason_PARAMS_ERROR ErrorReason = 230 ErrorReason_CODEC ErrorReason = 231 ErrorReason_LACK_OF_BALANCE ErrorReason = 250 ErrorReason_DEDUCTIONS_ERROR ErrorReason = 260 ErrorReason_SETTLEMENT_ERROR ErrorReason = 270 ErrorReason_NO_ACTIVE_BACKEND_ERROR ErrorReason = 280 )
func (ErrorReason) Descriptor ¶
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
func (ErrorReason) Enum ¶
func (x ErrorReason) Enum() *ErrorReason
func (ErrorReason) EnumDescriptor
deprecated
func (ErrorReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use ErrorReason.Descriptor instead.
func (ErrorReason) Number ¶
func (x ErrorReason) Number() protoreflect.EnumNumber
func (ErrorReason) String ¶
func (x ErrorReason) String() string
func (ErrorReason) Type ¶
func (ErrorReason) Type() protoreflect.EnumType
type GreeterClient ¶
type GreeterClient interface { // Sends a greeting SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) }
GreeterClient is the client API for Greeter 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 NewGreeterClient ¶
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient
type GreeterHTTPClient ¶
type GreeterHTTPClient interface {
SayHello(ctx context.Context, req *HelloRequest, opts ...http.CallOption) (rsp *HelloReply, err error)
}
func NewGreeterHTTPClient ¶
func NewGreeterHTTPClient(client *http.Client) GreeterHTTPClient
type GreeterHTTPClientImpl ¶
type GreeterHTTPClientImpl struct {
// contains filtered or unexported fields
}
func (*GreeterHTTPClientImpl) SayHello ¶
func (c *GreeterHTTPClientImpl) SayHello(ctx context.Context, in *HelloRequest, opts ...http.CallOption) (*HelloReply, error)
type GreeterHTTPServer ¶
type GreeterHTTPServer interface {
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
}
type GreeterServer ¶
type GreeterServer interface { // Sends a greeting SayHello(context.Context, *HelloRequest) (*HelloReply, error) // contains filtered or unexported methods }
GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility
type HelloReply ¶
type HelloReply struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
The response message containing the greetings
func (*HelloReply) Descriptor
deprecated
func (*HelloReply) Descriptor() ([]byte, []int)
Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
func (*HelloReply) GetMessage ¶
func (x *HelloReply) GetMessage() string
func (*HelloReply) ProtoMessage ¶
func (*HelloReply) ProtoMessage()
func (*HelloReply) ProtoReflect ¶
func (x *HelloReply) ProtoReflect() protoreflect.Message
func (*HelloReply) Reset ¶
func (x *HelloReply) Reset()
func (*HelloReply) String ¶
func (x *HelloReply) String() string
type HelloRequest ¶
type HelloRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
The request message containing the user's name.
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetName ¶
func (x *HelloRequest) GetName() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type UnimplementedGreeterServer ¶
type UnimplementedGreeterServer struct { }
UnimplementedGreeterServer must be embedded to have forward compatible implementations.
func (UnimplementedGreeterServer) SayHello ¶
func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
type UnsafeGreeterServer ¶
type UnsafeGreeterServer interface {
// contains filtered or unexported methods
}
UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.