-
-
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]: Using Number as Valid Boolean Query Parameter #2723
Comments
@dozheiny what do you think ? |
The QueryBool function uses strconv.ParseBool function for parsing boolean value types. And it supports 1 and 0 values. |
Also, check this out: https://stackoverflow.com/questions/727196/boolean-true-positive-1-or-negative-1 |
The current behavior and internal usage is clear. What is your opinion to change the return value to |
I think returning a |
I agree and would rather not take the python approach To consider multiple opinions I would like to vote with thumbs up or thumbs down in the initial feature request comment |
Any non-zero value should return
Should return |
As a proponent of developer autonomy, I believe query parameter handling should typically be managed by the application developer. Nonetheless, gofiber provides
Preserving the current implementation of QueryBool() respects Go’s conventions and developers’ expectations, ensuring framework consistency and reliability. |
I agree. |
Feature Description
It would be better right if Query Parameter Number is Valid Boolean Value using
QueryBool()
methodThe mechanism just like a python when casting type
int
tobool
.0
isfalse
otherwise istrue
Additional Context (optional)
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: