Documentation ¶
Index ¶
- Constants
- func GetDescFromCode(code string, data any, errDescList map[string]string) (string, any)
- 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 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 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 struct { Source string Input any ErrorDesc string Status int Description string Message any Child error }
func ToErrorState ¶
func ToErrorState(err error) *ErrorState
func (ErrorState) AddInput ¶ added in v0.3.1
func (e ErrorState) AddInput(in any) *ErrorState
func (ErrorState) AddSource ¶ added in v0.3.1
func (e ErrorState) AddSource(src string) *ErrorState
func (ErrorState) Error ¶
func (e ErrorState) Error() string
func (ErrorState) WsResponse ¶
func (e ErrorState) WsResponse() string
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) }
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.