feat: update route generate

This commit is contained in:
Rogee
2025-01-15 10:44:07 +08:00
parent 915e7cb2f7
commit 1e03cf6038
3 changed files with 23 additions and 13 deletions

View File

@@ -1,10 +1,19 @@
package f
import (
"mime/multipart"
"github.com/gofiber/fiber/v3"
"github.com/pkg/errors"
)
func File[T any](key string) func(fiber.Ctx) (*multipart.FileHeader, error) {
return func(ctx fiber.Ctx) (*multipart.FileHeader, error) {
_ = new(T)
return ctx.FormFile(key)
}
}
func Local[T any](key string) func(fiber.Ctx) (T, error) {
return func(ctx fiber.Ctx) (T, error) {
v := fiber.Locals[T](ctx, key)