status

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_common_status_status_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Response

type Response struct {

	// 请求id
	RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
	// 响应状态
	Status *Status `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

Response 通用的响应内容, 可以作为删除、更新和错误的响应内容

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetRequestId

func (x *Response) GetRequestId() string

func (*Response) GetStatus

func (x *Response) GetStatus() *Status

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

func (*Response) Validate

func (m *Response) Validate() error

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

func (m *Response) ValidateAll() error

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 Status

type Status struct {

	// 状态码,
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" 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"`
	// 元数据
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

Status 请求返回状态, ok对应http状态码200 InternalError对应http状态码500

func (*Status) Descriptor deprecated

func (*Status) Descriptor() ([]byte, []int)

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetCode

func (x *Status) GetCode() int32

func (*Status) GetMessage

func (x *Status) GetMessage() string

func (*Status) GetMetadata

func (x *Status) GetMetadata() map[string]string

func (*Status) GetReason

func (x *Status) GetReason() string

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

func (x *Status) ProtoReflect() protoreflect.Message

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

func (*Status) Validate

func (m *Status) Validate() error

Validate checks the field values on Status 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 (*Status) ValidateAll

func (m *Status) ValidateAll() error

ValidateAll checks the field values on Status 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 StatusMultiError, or nil if none found.

type StatusMultiError

type StatusMultiError []error

StatusMultiError is an error wrapping multiple validation errors returned by Status.ValidateAll() if the designated constraints aren't met.

func (StatusMultiError) AllErrors

func (m StatusMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (StatusMultiError) Error

func (m StatusMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type StatusValidationError

type StatusValidationError struct {
	// contains filtered or unexported fields
}

StatusValidationError is the validation error returned by Status.Validate if the designated constraints aren't met.

func (StatusValidationError) Cause

func (e StatusValidationError) Cause() error

Cause function returns cause value.

func (StatusValidationError) Error

func (e StatusValidationError) Error() string

Error satisfies the builtin error interface

func (StatusValidationError) ErrorName

func (e StatusValidationError) ErrorName() string

ErrorName returns error name.

func (StatusValidationError) Field

func (e StatusValidationError) Field() string

Field function returns field value.

func (StatusValidationError) Key

func (e StatusValidationError) Key() bool

Key function returns key value.

func (StatusValidationError) Reason

func (e StatusValidationError) Reason() string

Reason function returns reason value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL