Versions in this module Expand all Collapse all v1 v1.0.1 Feb 8, 2024 v1.0.0 Feb 8, 2024 Changes in this version + var Aborted = NewError(10019, "Aborted") + var AccessDenied = NewError(10011, "Access Denied") + var AlreadyExists = NewError(10005, "Conflict") + var Canceled = NewError(10014, "Canceled") + var DataLoss = NewError(10022, "Data Loss") + var DeadlineExceeded = NewError(10010, "Deadline Exceeded") + var FailedPrecondition = NewError(10018, "Failed Precondition") + var Forbidden = NewError(10008, "Forbidden") + var InternalServerError = NewError(10003, "Internal Server Error") + var InvalidParams = NewError(10001, "Invalid Parameter") + var LimitExceed = NewError(10009, "Limit Exceed") + var MethodNotAllowed = NewError(10012, "Method Not Allowed") + var NotFound = NewError(10004, "Not Found") + var OutOfRange = NewError(10020, "Out Of Range") + var PermissionDenied = NewError(10016, "Permission Denied") + var ResourceExhausted = NewError(10017, "Resource Exhausted") + var ServiceUnavailable = NewError(10013, "Service Unavailable") + var StatusAborted = NewRPCStatus(30010, "Aborted") + var StatusAccessDenied = NewRPCStatus(30022, "Access Denied") + var StatusAlreadyExists = NewRPCStatus(30006, "Already Exists") + var StatusCanceled = NewRPCStatus(30001, "Canceled") + var StatusDataLoss = NewRPCStatus(30015, "Data Loss") + var StatusDeadlineExceeded = NewRPCStatus(30004, "Deadline Exceeded") + var StatusFailedPrecondition = NewRPCStatus(30009, "Failed Precondition") + var StatusForbidden = NewRPCStatus(30019, "Forbidden") + var StatusInternalServerError = NewRPCStatus(30013, "Internal Server Error") + var StatusInvalidParams = NewRPCStatus(30003, "Invalid Parameter") + var StatusLimitExceed = NewRPCStatus(30020, "Limit Exceed") + var StatusMethodNotAllowed = NewRPCStatus(30021, "Method Not Allowed") + var StatusNotFound = NewRPCStatus(30005, "Not Found") + var StatusOutOfRange = NewRPCStatus(30011, "Out Of Range") + var StatusPermissionDenied = NewRPCStatus(30007, "Permission Denied") + var StatusResourceExhausted = NewRPCStatus(30008, "Resource Exhausted") + var StatusServiceUnavailable = NewRPCStatus(30014, "Service Unavailable") + var StatusSuccess = NewRPCStatus(0, "ok") + var StatusTimeout = NewRPCStatus(30017, "Request Timeout") + var StatusTooManyRequests = NewRPCStatus(30018, "Too Many Requests") + var StatusUnauthorized = NewRPCStatus(30016, "Unauthorized") + var StatusUnimplemented = NewRPCStatus(30012, "Unimplemented") + var StatusUnknown = NewRPCStatus(30002, "Unknown") + var Success = NewError(0, "ok") + var Timeout = NewError(10006, "Request Timeout") + var TooManyRequests = NewError(10007, "Too Many Requests") + var Unauthorized = NewError(10002, "Unauthorized") + var Unimplemented = NewError(10021, "Unimplemented") + var Unknown = NewError(10015, "Unknown") + func HCode(num int) int + func ListGRPCErrCodes(w http.ResponseWriter, _ *http.Request) + func RCode(num int) codes.Code + func ShowConfig(jsonData []byte) func(w http.ResponseWriter, r *http.Request) + type Detail struct + func Any(key string, val interface{}) Detail + func (d *Detail) String() string + type ErrInfo struct + Code int + Msg string + func ListHTTPErrCodes() []ErrInfo + type Error struct + func NewError(code int, msg string) *Error + func ParseError(err error) *Error + func ToHTTPErr(st *status.Status) *Error + func (e *Error) Code() int + func (e *Error) Details() []string + func (e *Error) Err() error + func (e *Error) Msg() string + func (e *Error) ToHTTPCode() int + func (e *Error) WithDetails(details ...string) *Error + func (e *Error) WithOutMsg(msg string) *Error + type RPCStatus struct + func NewRPCStatus(code codes.Code, msg string) *RPCStatus + func (g *RPCStatus) Code() codes.Code + func (g *RPCStatus) Err(details ...Detail) error + func (g *RPCStatus) Msg() string + func (g *RPCStatus) ToRPCCode() codes.Code + func (g *RPCStatus) ToRPCErr(desc ...string) error + type Responser interface + Error func(ctx *gin.Context, err error) bool + ParamError func(ctx *gin.Context, err error) + Success func(ctx *gin.Context, data interface{}) + func NewResponse(isFromRPC bool) Responser + func NewResponser(isFromRPC bool, httpErrors []*Error, rpcStatus []*RPCStatus) Responser