Boost Azure Demo
This commit is contained in:
21
Backend/internal/http/params/params.go
Normal file
21
Backend/internal/http/params/params.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Path: Backend/internal/http/params/params.go
|
||||
|
||||
package params
|
||||
|
||||
import (
|
||||
"boostai-backend/internal/http/respond"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func Int64PathParam(c *fiber.Ctx, name string) (int64, error) {
|
||||
value := strings.TrimSpace(c.Params(name))
|
||||
parsed, err := strconv.ParseInt(value, 10, 64)
|
||||
if err != nil || parsed <= 0 {
|
||||
return 0, respond.Error(c, fiber.StatusBadRequest, "invalid_request", "Invalid path parameter: "+name)
|
||||
}
|
||||
|
||||
return parsed, nil
|
||||
}
|
||||
Reference in New Issue
Block a user