Skip to content

Commit 87a8dea

Browse files
committed
docs: lint Bind.All documentation
1 parent 81bcf95 commit 87a8dea

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/api/bind.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,14 @@ app.Get("/user/:id", func(c fiber.Ctx) error {
441441
})
442442
```
443443

444-
### All
444+
### All
445445

446446
The `All` function binds data from various sources (URL parameters, request body, query parameters, headers, and cookies) into the provided struct pointer `out`. It processes each source in a predefined order, applying data to the struct fields based on their tags.
447447

448448
#### Precedence Order
449+
449450
The binding sources have the following precedence:
451+
450452
1. **URL Parameters (URI)**
451453
2. **Request Body (e.g., JSON or form data)**
452454
3. **Query Parameters**
@@ -459,11 +461,11 @@ func (b *Bind) All(out any) error
459461

460462
``` go title="Example"
461463
type User struct {
462-
Name string `query:"name" json:"name" form:"name"`
463-
Email string `json:"email" form:"email"`
464-
Role string `header:"X-User-Role"`
465-
SessionID string `json:"session_id" cookie:"session_id"`
466-
ID int `param:"id" query:"id" json:"id" form:"id"`
464+
Name string `query:"name" json:"name" form:"name"`
465+
Email string `json:"email" form:"email"`
466+
Role string `header:"X-User-Role"`
467+
SessionID string `json:"session_id" cookie:"session_id"`
468+
ID int `param:"id" query:"id" json:"id" form:"id"`
467469
}
468470

469471
app.Post("/users", func(c fiber.Ctx) error {
@@ -477,6 +479,7 @@ app.Post("/users", func(c fiber.Ctx) error {
477479
return c.JSON(user)
478480
})
479481
```
482+
480483
## Custom
481484

482485
To use custom binders, you have to use this method.

0 commit comments

Comments
 (0)