Skip to content
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 support for binding query params into a struct? #35

Open
adelowo opened this issue Jul 6, 2021 · 1 comment
Open

Add support for binding query params into a struct? #35

adelowo opened this issue Jul 6, 2021 · 1 comment

Comments

@adelowo
Copy link

adelowo commented Jul 6, 2021

type req struct {
    PerPage string `query:"per_page"`
    APIKey string `query:"key"`
}

// an alternative to render.Bind to check query params and convert into req
@ricci2511
Copy link

ricci2511 commented Jun 25, 2023

I know this feature request is a bit old but this would still be useful to have.

I think implementing this would be pretty straightforward, but if I'm not mistaken we would need to handle the conversion from the query param string to the original field type, which can be a bit cumbersome. A good reference for handling the type conversions could be gorilla/schema.

I would be down to do a pr if the leads have any interest in this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants