diff --git a/docs/guide/utils.md b/docs/guide/utils.md index 24ed2362ba..1f3fec1c69 100644 --- a/docs/guide/utils.md +++ b/docs/guide/utils.md @@ -45,9 +45,9 @@ func GetReqHeader[V any](c Ctx, key string, defaultValue ...V) V ```go title="Example" app.Get("/search", func(c fiber.Ctx) error { // curl -X GET http://example.com/search -H "X-Request-ID: 12345" -H "X-Request-Name: John" - GetReqHeader[int](c, "X-Request-ID") // => returns 12345 as integer. - GetReqHeader[string](c, "X-Request-Name") // => returns "John" as string. - GetReqHeader[string](c, "unknownParam", "default") // => returns "default" as string. + fiber.GetReqHeader[int](c, "X-Request-ID") // => returns 12345 as integer. + fiber.GetReqHeader[string](c, "X-Request-Name") // => returns "John" as string. + fiber.GetReqHeader[string](c, "unknownParam", "default") // => returns "default" as string. // ... }) ``` @@ -97,8 +97,8 @@ func Params[V any](c Ctx, key string, defaultValue ...V) V ```go title="Example" app.Get("/user/:user/:id", func(c fiber.Ctx) error { // http://example.com/user/john/25 - Params[int](c, "id") // => returns 25 as integer. - Params[int](c, "unknownParam", 99) // => returns the default 99 as integer. + fiber.Params[int](c, "id") // => returns 25 as integer. + fiber.Params[int](c, "unknownParam", 99) // => returns the default 99 as integer. // ... return c.SendString("Hello, " + fiber.Params[string](c, "user")) }) @@ -116,9 +116,9 @@ func Query[V any](c Ctx, key string, defaultValue ...V) V ```go title="Example" app.Get("/search", func(c fiber.Ctx) error { // http://example.com/search?name=john&age=25 - Query[string](c, "name") // => returns "john" - Query[int](c, "age") // => returns 25 as integer. - Query[string](c, "unknownParam", "default") // => returns "default" as string. + fiber.Query[string](c, "name") // => returns "john" + fiber.Query[int](c, "age") // => returns 25 as integer. + fiber.Query[string](c, "unknownParam", "default") // => returns "default" as string. // ... }) ``` diff --git a/docs/whats_new.md b/docs/whats_new.md index 321df424d6..7501c2b57e 100644 --- a/docs/whats_new.md +++ b/docs/whats_new.md @@ -497,7 +497,7 @@ func main() { app := fiber.New() app.Get("/convert", func(c fiber.Ctx) error { - value, err := Convert[string](c.Query("value"), strconv.Atoi, 0) + value, err := fiber.Convert[string](c.Query("value"), strconv.Atoi, 0) if err != nil { return c.Status(fiber.StatusBadRequest).SendString(err.Error()) } @@ -575,7 +575,7 @@ func main() { app := fiber.New() app.Get("/params/:id", func(c fiber.Ctx) error { - id := Params[int](c, "id", 0) + id := fiber.Params[int](c, "id", 0) return c.JSON(id) }) @@ -607,7 +607,7 @@ func main() { app := fiber.New() app.Get("/query", func(c fiber.Ctx) error { - age := Query[int](c, "age", 0) + age := fiber.Query[int](c, "age", 0) return c.JSON(age) }) @@ -640,7 +640,7 @@ func main() { app := fiber.New() app.Get("/header", func(c fiber.Ctx) error { - userAgent := GetReqHeader[string](c, "User-Agent", "Unknown") + userAgent := fiber.GetReqHeader[string](c, "User-Agent", "Unknown") return c.JSON(userAgent) })