-
-
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
✨ feature: add AllParams method #1853
Conversation
I don't know if duplicate keys are supported (e.g. |
In your handling you describe query parameters and no resource(route) parameters With the resource parameters or route parameters, we know beforehand how many and which ones they are, because they are predefined. |
Sorry for the confusion 😔 |
Hi dude, sorry but I don't like this approach because we have a method |
I created PR because of "Accepting PR" label 🤔. What do you think @hi019 @ReneWerner87 |
This access by route is not really intuitive, I am more in favor of access by method |
I am so sorry, but I commented on my opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
func (c *Ctx) AllParams() map[string]string { | ||
params := make(map[string]string, len(c.route.Params)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (c *Ctx) AllParams() map[string]string { | |
params := make(map[string]string, len(c.route.Params)) | |
func (c *Ctx) AllParams() map[string][]string { | |
params := make(map[string][]string, len(c.route.Params)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no list, always only one parameter value for one parameter key
func (c *Ctx) AllParams() map[string]string { | ||
params := make(map[string]string, len(c.route.Params)) | ||
for _, param := range c.route.Params { | ||
params[param] = c.Params(param) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please adjust it based on suggestion when having many params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look at tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't understand why to need make it []string instead of string. Can you explain me?
All good, everyone can freely express his opinion here Your opinions are all welcome, helps us think about it again and reassess the whole thing |
Signature:
func (c *Ctx) AllParams() map[string]string
Benchmark Result:
Benchmark_Ctx_AllParams-4 2544381 530.9 ns/op 336 B/op 2 allocs/op
Closes:
#1816