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) LogValue() slog.Value
- 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 FileResponse
- type Receipt
- type RespData
- type RespType
- type ResponseHandler
- type WebHanlder
- func (m WebHanlder) Error(w webFramework.WebFramework, err error)
- func (m WebHanlder) GetErrorsArray(message string, data any) []ErrorResponse
- func (m WebHanlder) OK(w webFramework.WebFramework, resp any)
- func (m WebHanlder) OKWithAttachment(w webFramework.WebFramework, attachment *FileResponse)
- func (m WebHanlder) OKWithReceipt(w webFramework.WebFramework, resp any, receipt *Receipt)
- func (m WebHanlder) Respond(code, status int, message string, data any, abort bool, ...)
- func (m WebHanlder) RespondWithAttachment(code, status int, message string, file *FileResponse, abort bool, ...)
- func (m WebHanlder) RespondWithReceipt(code, status int, message string, data any, printData *Receipt, abort bool, ...)
- 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) LogValue ¶ added in v0.15.0
LogValue implements slog.LogValuer and returns a grouped value with fields redacted. See https://pkg.go.dev/log/slog#LogValuer
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 LogValue() slog.Value }
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
func Unwrap ¶ added in v0.15.0
func Unwrap(err error) (bool, ErrorState)
type FileResponse ¶ added in v0.10.4
type ResponseHandler ¶
type ResponseHandler interface { OK(w webFramework.WebFramework, resp any) OKWithReceipt(w webFramework.WebFramework, resp any, receipt *Receipt) OKWithAttachment(w webFramework.WebFramework, file *FileResponse) Error(w webFramework.WebFramework, err error) }
type WebHanlder ¶ added in v0.15.0
func (WebHanlder) Error ¶ added in v0.15.0
func (m WebHanlder) Error(w webFramework.WebFramework, err error)
func (WebHanlder) GetErrorsArray ¶ added in v0.15.0
func (m WebHanlder) GetErrorsArray(message string, data any) []ErrorResponse
func (WebHanlder) OK ¶ added in v0.15.0
func (m WebHanlder) OK(w webFramework.WebFramework, resp any)
func (WebHanlder) OKWithAttachment ¶ added in v0.15.0
func (m WebHanlder) OKWithAttachment(w webFramework.WebFramework, attachment *FileResponse)
func (WebHanlder) OKWithReceipt ¶ added in v0.15.0
func (m WebHanlder) OKWithReceipt(w webFramework.WebFramework, resp any, receipt *Receipt)
func (WebHanlder) Respond ¶ added in v0.15.0
func (m WebHanlder) Respond(code, status int, message string, data any, abort bool, w webFramework.WebFramework)
func (WebHanlder) RespondWithAttachment ¶ added in v0.15.0
func (m WebHanlder) RespondWithAttachment(code, status int, message string, file *FileResponse, abort bool, w webFramework.WebFramework)
func (WebHanlder) RespondWithReceipt ¶ added in v0.15.0
func (m WebHanlder) 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.