Documentation ¶
Index ¶
- Variables
- type BaseResponse
- func (*BaseResponse) Descriptor() ([]byte, []int)deprecated
- func (x *BaseResponse) Error() string
- func (x *BaseResponse) GetCode() Code
- func (x *BaseResponse) GetMessage() string
- func (x *BaseResponse) GetReason() string
- func (*BaseResponse) ProtoMessage()
- func (x *BaseResponse) ProtoReflect() protoreflect.Message
- func (x *BaseResponse) Reset()
- func (x *BaseResponse) SetMessage(msg string) *BaseResponse
- func (x *BaseResponse) String() string
- func (x *BaseResponse) Success() bool
- func (m *BaseResponse) Validate() error
- func (m *BaseResponse) ValidateAll() error
- type BaseResponseMultiError
- type BaseResponseValidationError
- func (e BaseResponseValidationError) Cause() error
- func (e BaseResponseValidationError) Error() string
- func (e BaseResponseValidationError) ErrorName() string
- func (e BaseResponseValidationError) Field() string
- func (e BaseResponseValidationError) Key() bool
- func (e BaseResponseValidationError) Reason() string
- type Code
- func (x Code) BaseResponse() *BaseResponse
- func (x Code) BaseResponseWithError(err error) *BaseResponse
- func (x Code) BaseResponseWithMessage(msg string) *BaseResponse
- func (Code) Descriptor() protoreflect.EnumDescriptor
- func (x Code) Enum() *Code
- func (Code) EnumDescriptor() ([]byte, []int)deprecated
- func (x Code) Number() protoreflect.EnumNumber
- func (x Code) String() string
- func (Code) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( Code_name = map[int32]string{ 0: "OK", 10001: "InternalError", 10002: "InvalidParams", 10003: "DBError", 10004: "CacheError", 20001: "UserNotExist", 20002: "UserExist", 20003: "InvalidUsernameOrPassword", 30001: "RelationNotExist", 30002: "RelationExist", 30003: "InvalidUpdateRelationAction", 31001: "FriendRequestNotExist", 31002: "FriendRequestStatusError", 40001: "UserNotOnline", 50001: "GroupNotExist", 50002: "GroupExist", 50003: "NotGroupMember", 50004: "NotGroupOwner", 50005: "GroupLimitExceed", } Code_value = map[string]int32{ "OK": 0, "InternalError": 10001, "InvalidParams": 10002, "DBError": 10003, "CacheError": 10004, "UserNotExist": 20001, "UserExist": 20002, "InvalidUsernameOrPassword": 20003, "RelationNotExist": 30001, "RelationExist": 30002, "InvalidUpdateRelationAction": 30003, "FriendRequestNotExist": 31001, "FriendRequestStatusError": 31002, "UserNotOnline": 40001, "GroupNotExist": 50001, "GroupExist": 50002, "NotGroupMember": 50003, "NotGroupOwner": 50004, "GroupLimitExceed": 50005, } )
Enum value maps for Code.
var File_transport_response_response_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type BaseResponse struct { Code Code `protobuf:"varint,1,opt,name=code,proto3,enum=api.transport.response.Code" json:"code,omitempty"` Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
BaseResponse use as define response code and message
func NewBaseResponse ¶
func NewBaseResponse(code Code) *BaseResponse
func NewBaseResponseWithError ¶
func NewBaseResponseWithError(err error) *BaseResponse
func NewBaseResponseWithMessage ¶
func NewBaseResponseWithMessage(code Code, msg string) *BaseResponse
func (*BaseResponse) Descriptor
deprecated
func (*BaseResponse) Descriptor() ([]byte, []int)
Deprecated: Use BaseResponse.ProtoReflect.Descriptor instead.
func (*BaseResponse) Error ¶
func (x *BaseResponse) Error() string
func (*BaseResponse) GetCode ¶
func (x *BaseResponse) GetCode() Code
func (*BaseResponse) GetMessage ¶
func (x *BaseResponse) GetMessage() string
func (*BaseResponse) GetReason ¶
func (x *BaseResponse) GetReason() string
func (*BaseResponse) ProtoMessage ¶
func (*BaseResponse) ProtoMessage()
func (*BaseResponse) ProtoReflect ¶
func (x *BaseResponse) ProtoReflect() protoreflect.Message
func (*BaseResponse) Reset ¶
func (x *BaseResponse) Reset()
func (*BaseResponse) SetMessage ¶
func (x *BaseResponse) SetMessage(msg string) *BaseResponse
func (*BaseResponse) String ¶
func (x *BaseResponse) String() string
func (*BaseResponse) Success ¶
func (x *BaseResponse) Success() bool
func (*BaseResponse) Validate ¶
func (m *BaseResponse) Validate() error
Validate checks the field values on BaseResponse 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 (*BaseResponse) ValidateAll ¶
func (m *BaseResponse) ValidateAll() error
ValidateAll checks the field values on BaseResponse 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 BaseResponseMultiError, or nil if none found.
type BaseResponseMultiError ¶
type BaseResponseMultiError []error
BaseResponseMultiError is an error wrapping multiple validation errors returned by BaseResponse.ValidateAll() if the designated constraints aren't met.
func (BaseResponseMultiError) AllErrors ¶
func (m BaseResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (BaseResponseMultiError) Error ¶
func (m BaseResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type BaseResponseValidationError ¶
type BaseResponseValidationError struct {
// contains filtered or unexported fields
}
BaseResponseValidationError is the validation error returned by BaseResponse.Validate if the designated constraints aren't met.
func (BaseResponseValidationError) Cause ¶
func (e BaseResponseValidationError) Cause() error
Cause function returns cause value.
func (BaseResponseValidationError) Error ¶
func (e BaseResponseValidationError) Error() string
Error satisfies the builtin error interface
func (BaseResponseValidationError) ErrorName ¶
func (e BaseResponseValidationError) ErrorName() string
ErrorName returns error name.
func (BaseResponseValidationError) Field ¶
func (e BaseResponseValidationError) Field() string
Field function returns field value.
func (BaseResponseValidationError) Key ¶
func (e BaseResponseValidationError) Key() bool
Key function returns key value.
func (BaseResponseValidationError) Reason ¶
func (e BaseResponseValidationError) Reason() string
Reason function returns reason value.
type Code ¶
type Code int32
const ( Code_OK Code = 0 // common error codes Code_InternalError Code = 10001 Code_InvalidParams Code = 10002 Code_DBError Code = 10003 Code_CacheError Code = 10004 // user error codes Code_UserNotExist Code = 20001 Code_UserExist Code = 20002 Code_InvalidUsernameOrPassword Code = 20003 // relation error codes Code_RelationNotExist Code = 30001 Code_RelationExist Code = 30002 Code_InvalidUpdateRelationAction Code = 30003 // friend request error codes Code_FriendRequestNotExist Code = 31001 Code_FriendRequestStatusError Code = 31002 // push server error codes Code_UserNotOnline Code = 40001 // group error codes Code_GroupNotExist Code = 50001 Code_GroupExist Code = 50002 Code_NotGroupMember Code = 50003 Code_NotGroupOwner Code = 50004 Code_GroupLimitExceed Code = 50005 )
func (Code) BaseResponse ¶
func (x Code) BaseResponse() *BaseResponse
func (Code) BaseResponseWithError ¶
func (x Code) BaseResponseWithError(err error) *BaseResponse
func (Code) BaseResponseWithMessage ¶
func (x Code) BaseResponseWithMessage(msg string) *BaseResponse
func (Code) Descriptor ¶
func (Code) Descriptor() protoreflect.EnumDescriptor
func (Code) EnumDescriptor
deprecated
func (Code) Number ¶
func (x Code) Number() protoreflect.EnumNumber
func (Code) Type ¶
func (Code) Type() protoreflect.EnumType