Documentation
¶
Index ¶
- Variables
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetCode() int32
- func (x *Response) GetData() *anypb.Any
- func (x *Response) GetMessage() string
- func (x *Response) GetSuccess() bool
- 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
Constants ¶
This section is empty.
Variables ¶
var File_common_v1_common_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response struct {
// 响应码(7位数字)
// 格式: Category(1位) + Module(3位) + File(3位)
// Category: 2=成功, 3=业务错误, 4=权限错误, 5=系统错误, 6=网络错误, 7=数据错误, 8=配置错误, 9=第三方错误
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
// 成功标识: true=成功, false=失败
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
// 响应消息
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
// 响应数据(使用Any类型以支持任意数据结构)
Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
Response 统一响应结构
func (*Response) Descriptor
deprecated
func (*Response) GetMessage ¶
func (*Response) GetSuccess ¶
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.