I have an idea to develop a package for parsing params needed to handle HTTP request when developing REST services. For example, the request (simplified):
PUT /user/1/?someGetParam=value
{
"name": "Jack",
"email": "Lala"
}
Params here are "1" (from the path), "value" (from GET), and body, encoded in JSON.
The library will parse that all into one struct, which you should define. The request bellow can be parsed into such struct:
type UpdateUserParams struct {
ID uint `path:"id"`
SomeGet string `get:"SomeGetParam"`
Body struct {
Name string
Email string
} `body:"+"`
}
What do u think? Will u use it? What features u think not enough?
The main feauture here is checking arams corresponding to go types. If instead of having integer in path param ID, you have to make if in every request: