This commit is contained in:
loveuer
2025-07-14 10:48:21 +08:00
parent b48fa05d9f
commit 13ca43ee28
25 changed files with 830 additions and 125 deletions

View File

@ -2,6 +2,7 @@ package resp
import (
"errors"
"github.com/gofiber/fiber/v3"
)
@ -42,20 +43,25 @@ func RE(c fiber.Ctx, err error) error {
func _r(c fiber.Ctx, r *res, args ...any) error {
length := len(args)
switch length {
case 0:
break
case 1:
if length == 0 {
goto END
}
if length >= 1 {
if msg, ok := args[0].(string); ok {
r.Msg = msg
} else {
r.Data = args[0]
}
case 2:
}
if length >= 2 {
r.Data = args[1]
case 3:
}
if length >= 3 {
r.Err = args[2]
}
END:
if r.Msg == "" {
r.Msg = Msg(r.Status)