Documentation ¶
Index ¶
- func Error(c *fiber.Ctx, options ...AppErrorOption) error
- func ErrorCode(c *fiber.Ctx, code int, options ...AppErrorOption) error
- func NewValidationErrors(validations validator.ValidationErrors) []validationError
- func Success(c *fiber.Ctx, options ...SuccessOption) error
- type AppErrorOption
- type SuccessOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(c *fiber.Ctx, options ...AppErrorOption) error
Error return json response with standard error response as the structure.
func ErrorCode ¶
func ErrorCode(c *fiber.Ctx, code int, options ...AppErrorOption) error
ErrorCode return json response with standard error response as the structure and additionally set the response status code.
func NewValidationErrors ¶
func NewValidationErrors(validations validator.ValidationErrors) []validationError
NewValidationErrors return ready to display error validations.
func Success ¶
func Success(c *fiber.Ctx, options ...SuccessOption) error
Success return json response with standard success response as the structure.
Types ¶
type AppErrorOption ¶
type AppErrorOption func(*appError)
AppErrorOption an option for error response.
func WithErr ¶
func WithErr(err error) AppErrorOption
WithErr option to add given error message to error response as `message` field.
func WithErrCode ¶
func WithErrCode(code string) AppErrorOption
WithErrCode option to add given code to error response as `code` field.
func WithErrDetail ¶
func WithErrDetail(detail any) AppErrorOption
WithErrDetail option to add given detail to error response as `detail` field.
func WithErrMsg ¶
func WithErrMsg(msg string) AppErrorOption
WithErrMsg option to add given message to error response as `message` field.
func WithErrValidation ¶
func WithErrValidation(valid validator.ValidationErrors) AppErrorOption
WithErrValidation option to add given valid to error response as `detail` field.
type SuccessOption ¶
type SuccessOption func(*appSuccess)
SuccessOption an option for success response.
func WithData ¶
func WithData(data any) SuccessOption
WithData option to add the given data to success response as `data` field.
func WithMeta ¶
func WithMeta(meta any) SuccessOption
WithMeta option to add the given meta to success response as `meta` field.
func WithMsg ¶
func WithMsg(msg string) SuccessOption
WithMsg option to add given msg to success response as `message` field.