-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
✨ Add method to get an integer directly from the Ctx params (route params) #1243
Conversation
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Thx for the contribution and effort Could you add an pull request here |
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
thanks for the implementation, we have internally consulted a bit and merge the pull request, but it may be that we still make optimizations and add another method for floats. |
@eacp |
Added documentation for as requested by [this comment](gofiber/fiber#1243 (comment))
@ReneWerner87 I have added the documentation in this pr |
Please provide enough information so that others can review your pull request:
I added a method to Ctx and its tests. The method is
ParamsInt
. It helps developers get an integer directly from the requestExplain the details for making this change. What existing problem does the pull request solve?
It is very common to send integers like IDs directly in the route as parameters. I added an utility function,
ParamsInt
to directly get an integer from the Ctx that is passed on each request. It returns zero and an error if the param cannot be found OR if the param is not a valid integerCommit formatting
Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/
✨