Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ClientClosed is non-standard http status code, // which defined by nginx. // https://httpstatus.in/499/ ClientClosed = 499 )
Variables ¶
View Source
var File_coder_status_proto protoreflect.FileDescriptor
Functions ¶
func FromGRPCCode ¶
FromGRPCCode converts a gRPC error code into the corresponding HTTP response status.
func ToGRPCCode ¶
ToGRPCCode converts an HTTP error code into the corresponding gRPC response status.
Types ¶
type Converter ¶
type Converter interface { // ToGRPCCode converts an HTTP error code into the corresponding gRPC response status. ToGRPCCode(code int) gcodes.Code // FromGRPCCode converts a gRPC error code into the corresponding HTTP response status. FromGRPCCode(code gcodes.Code) int }
Converter is a status converter.
var DefaultConverter Converter = statusConverter{}
DefaultConverter default converter.
type Status ¶
type Status struct { // 业务错误码 Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 拓展信息 Metadata map[string]string `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Status) Descriptor
deprecated
func (*Status) GetMetadata ¶
func (*Status) ProtoMessage ¶
func (*Status) ProtoMessage()
func (*Status) ProtoReflect ¶
func (x *Status) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.