Documentation ¶
Index ¶
- Constants
- func BadRequest(ctx *gin.Context, cause error, msgs ...string)
- func BindJSON[J any, R any](fn func(context.Context, J) (R, *Error)) gin.HandlerFunc
- func BindQuery[Q any, R any](fn func(context.Context, Q) (R, *Error)) gin.HandlerFunc
- func HandleError(ctx *gin.Context, err *Error)
- func JSON(ctx *gin.Context, data any, err *Error)
- func Log2Tsv(fp string, w io.Writer, times ...time.Time) (err error)
- func NewLogHandler[T any](logger *wrap.Logger, name string) gin.HandlerFunc
- func Ok(ctx *gin.Context)
- type Error
- func ErrAccessDenied(cause error, msg string) (out *Error)
- func ErrBadRequest(cause error, msg string) (out *Error)
- func ErrConflict(cause error, msg string) (out *Error)
- func ErrInvalidParameter(cause error, msg string) (out *Error)
- func ErrInvalidToken(cause error) (out *Error)
- func ErrLoginRequired() (out *Error)
- func ErrNoResource(cause error) (out *Error)
- func ErrNotFound(cause error) (out *Error)
- func ErrNotImplemented(cause error) (out *Error)
- func ErrNotRoute() (out *Error)
- func ErrPanic(data any, opts ...Option) (out *Error)
- func ErrParseFailed(cause error) (out *Error)
- func ErrServerError(cause error) (out *Error)
- func ErrServerIsBusy(casue error) (out *Error)
- func ErrThirdPartyService(casue error, msg string) (out *Error)
- func ErrTooManyRequests(casue error) (out *Error)
- func ErrUnauthorized(cause error, msg string) (out *Error)
- func ErrUnexpected(cause error) (out *Error)
- func NewError(cause error, httpCode, code int, opts ...Option) (out *Error)
- type Option
Constants ¶
View Source
const ( KEY_RequestId = "_RequestId" KEY_UserId = "_UserId" KEY_UserRole = "UserRole" KEY_User = "User" KEY_Error = "error" KEY_Event = "event" )
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func NewLogHandler ¶
Types ¶
type Error ¶
type Error struct { Cause string `json:"cause"` HttpCode int `json:"httpCode"` Code int `json:"code"` Msg string `json:"msg"` // contains filtered or unexported fields }
func ErrAccessDenied ¶
func ErrBadRequest ¶
func ErrConflict ¶
func ErrInvalidParameter ¶
func ErrLoginRequired ¶
func ErrLoginRequired() (out *Error)
func ErrNoResource ¶
func ErrNotFound ¶
func ErrParseFailed ¶
func ErrServerError ¶
func ErrServerIsBusy ¶
func ErrThirdPartyService ¶
func ErrTooManyRequests ¶
func ErrUnauthorized ¶
func ErrUnexpected ¶
Click to show internal directories.
Click to hide internal directories.