-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ v3 (feature): initial support for binding #1981
Conversation
use pointer/references instead of copies
embed bind into the ctx
- add URI binder.
- add response header binder.
- add response header binder.
- add cookie binder.
- custom binder support for body binding. - test case for custom binder.
- add map[string][]string & map[string]string support for binders.
- fix Test_Bind_Header_Map
- Functional Should/Must
- custom struct validator support.
- README for binding. - Docs for binding methods.
- Bind() -> BindVars(), Binding() -> Bind()
- fix doc problems
- fix doc problems
I have another idea and POC about this feature, we do not need internal temporary https://github.com/Trim21/inj/blob/master/example/main.go#L27 with go 1.18 generic, we can have a 2 allocs and good performance and (IMO) easy to use API like this: app.Get("/:id", Wrap(func(c *fiber.Ctx, req Req) error {
return c.JSON(req)
})) and a 5 fields benchmark, (
|
I checked your code and it seems good idea to use context methods instead of creating temporarily map. I'll check it in the next PR |
Partially related: #1821
This PR aims to create detailed and moduler binding system for Fiber v3. Fiber ctx will be more clean thanks to this feature. Also Fiber will be able to bind into the map.
To-Do List:
Note: I won't change gorilla/schema in this PR. But next PRs, i'll create more minimal and useful parser for Fiber.