Documentation ¶
Index ¶
- Constants
- func GetDescFromCode(code string, data any, errDescList map[string]string) (string, any)
- func GetStack(skip int, exclude string) string
- func JustPrintResp(respBytes []byte, desc string, status int) (int, map[string]string, any, error)
- func ParseRemoteRespJson(respBytes []byte, desc string, status int) (int, map[string]string, any, error)
- func ParseWsRemoteResp(respBytes []byte, desc string, status int) (int, map[string]string, any, error)
- type DbResponse
- type ErrorData
- func (e ErrorData) Child(err ErrorState) ErrorState
- func (e ErrorData) ChildErr(err error) ErrorState
- func (e ErrorData) Error() string
- func (e ErrorData) Format(header string, stack *strings.Builder)
- func (e ErrorData) GetDescription() string
- func (e ErrorData) GetInput() any
- func (e ErrorData) GetMessage() any
- func (e ErrorData) GetStatus() int
- func (e *ErrorData) Input(in any) ErrorState
- func (e ErrorData) SetDescription(desc string) ErrorState
- func (e ErrorData) SetMessage(msg any) ErrorState
- func (e ErrorData) SetStatus(status int) ErrorState
- func (e ErrorData) WsResponse() string
- type ErrorResponse
- type ErrorState
- type InternalError
- type Receipt
- type ResponseHandler
- type WsRemoteResponse
- type WsResponse
Constants ¶
View Source
const ( NO_DATA_FOUND = "NO-DATA-FOUND" SYSTEM_FAULT = "SYSTEM_FAULT" SYSTEM_FAULT_DESC = "خطای سیستمی" )
Variables ¶
This section is empty.
Functions ¶
func GetDescFromCode ¶ added in v0.3.21
func JustPrintResp ¶
func ParseRemoteRespJson ¶
Types ¶
type DbResponse ¶
type ErrorData ¶ added in v0.9.5
type ErrorData struct { Status int Description string Message any // contains filtered or unexported fields }
func (ErrorData) Child ¶ added in v0.9.5
func (e ErrorData) Child(err ErrorState) ErrorState
func (ErrorData) ChildErr ¶ added in v0.9.5
func (e ErrorData) ChildErr(err error) ErrorState
func (ErrorData) GetDescription ¶ added in v0.9.5
func (ErrorData) GetMessage ¶ added in v0.9.5
func (*ErrorData) Input ¶ added in v0.9.5
func (e *ErrorData) Input(in any) ErrorState
func (ErrorData) SetDescription ¶ added in v0.9.5
func (e ErrorData) SetDescription(desc string) ErrorState
func (ErrorData) SetMessage ¶ added in v0.9.5
func (e ErrorData) SetMessage(msg any) ErrorState
func (ErrorData) SetStatus ¶ added in v0.9.5
func (e ErrorData) SetStatus(status int) ErrorState
func (ErrorData) WsResponse ¶ added in v0.9.5
type ErrorResponse ¶
func FormatErrorResp ¶
func FormatErrorResp(errs error, trans ut.Translator) []ErrorResponse
func GetErrorsArray ¶
func GetErrorsArray(message string, data any) []ErrorResponse
func GetErrorsArrayWithMap ¶
func GetErrorsArrayWithMap(incomingDesc string, data any, errDescList map[string]string) []ErrorResponse
type ErrorState ¶
type ErrorState interface { Error() string Input(in any) ErrorState GetInput() any WsResponse() string SetStatus(int) ErrorState SetDescription(string) ErrorState SetMessage(any) ErrorState ChildErr(error) ErrorState Child(ErrorState) ErrorState GetStatus() int GetDescription() string GetMessage() any }
func Errors ¶ added in v0.9.12
func Errors(status int, desc string, message any, err ErrorState) ErrorState
func ToErrorState ¶
func ToErrorState(err error) ErrorState
type InternalError ¶
func (InternalError) Error ¶
func (e InternalError) Error() string
type ResponseHandler ¶
type ResponseHandler interface { GetErrorsArray(message string, data any) []ErrorResponse HandleErrorState(err error, status int, message string, data any, w webFramework.WebFramework) Respond(code, status int, message string, data any, abort bool, w webFramework.WebFramework) RespondWithReceipt(code, status int, message string, data any, printData *Receipt, abort bool, w webFramework.WebFramework) OK(w webFramework.WebFramework, resp any) OKWithReceipt(w webFramework.WebFramework, resp any, receipt *Receipt) Error(w webFramework.WebFramework, err ErrorState) }
type WsRemoteResponse ¶
type WsRemoteResponse struct { Status int `json:"status"` Description string `json:"description"` Result any `json:"result,omitempty"` ErrorData []ErrorResponse `json:"errors,omitempty"` }
func (WsRemoteResponse) ToErrorState ¶ added in v0.1.7
func (e WsRemoteResponse) ToErrorState() ErrorState
Click to show internal directories.
Click to hide internal directories.