package
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Jan 22, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
-
func BadRequest(c fiber.Ctx, msg string) error
-
func Conflict(c fiber.Ctx, msg string) error
-
func Fail(c fiber.Ctx, httpStatus int, code ErrorCode, msg string) error
-
func Forbidden(c fiber.Ctx, msg string) error
-
func Internal(c fiber.Ctx, msg string) error
-
func NotFound(c fiber.Ctx, msg string) error
-
func OK[T any](c fiber.Ctx, data T) error
-
func Unauthorized(c fiber.Ctx, msg string) error
-
type Envelope
-
type ErrorCode
BadRequest helper.
BadRequest 辅助函数。
Conflict helper.
Conflict 辅助函数。
Fail returns error response.
Fail 返回错误响应。
Forbidden helper.
Forbidden 辅助函数。
Internal helper.
Internal 辅助函数。
NotFound helper.
NotFound 辅助函数。
OK returns success response.
OK 返回成功响应。
Unauthorized helper.
Unauthorized 辅助函数。
type Envelope[T any] struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Data T `json:"data,omitempty"`
}
Envelope is a unified API response wrapper.
Envelope 是统一 API 返回结构。
ErrorCode defines unified error codes.
ErrorCode 定义统一错误码。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.