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

Support for binding query parameters similar to binding request payload #1160

Open
shashank-zopsmart opened this issue Oct 29, 2024 · 6 comments
Labels
Service Related to external http, grpc communciation , middlewares etc.

Comments

@shashank-zopsmart
Copy link

ctx.Bind() can have feature to bind the query parameters to struct to fields that have special tag (say qparam) along with binding request payload.

@surajit-zs
Copy link
Contributor

This struct defines fields for binding HTTP request parameters using param tags:

type Filter struct {
	ID    int      `param:"id"`    // Path parameter for item ID
	GG    []string `param:"gg"`    // Query parameter for multiple values
	Query string   `param:"query"` // Single query parameter for search term
}

ID: an integer path parameter, e.g., /items/{id}
GG: a slice of strings to handle multiple values from query parameters, e.g., ?gg=value1&gg=value2
Query: a single query parameter for search, e.g., ?query=example

@aryanmehrotra

@vipul-rawat vipul-rawat added the Service Related to external http, grpc communciation , middlewares etc. label Oct 31, 2024
@rigved-telang
Copy link
Contributor

Hi, can I please be assigned this issue? I would like to work on it.

@aryanmehrotra
Copy link
Member

@surajit-zs should we have it as part of the Bind maybe it would be an overkill, Bind is for body and taking query params and path params when we already allow to take from context.

It would definitely ease the process, but should it be a different method altogether?

@rigved-telang we would need to analyse if this should be part of bind.

@rigved-telang
Copy link
Contributor

Cool. Is there any other issue that needs to be picked on priority, I am trying to learn Go so any issue is fine by me

@aryanmehrotra
Copy link
Member

You may check issue 1154

@surajit-zs
Copy link
Contributor

@aryanmehrotra not in existing bind
can we create a new method for params bind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service Related to external http, grpc communciation , middlewares etc.
Projects
None yet
Development

No branches or pull requests

5 participants