yes, map is another option, but programmer need to write code to convert string to int, float, time ...
my origin design is the web framework can handle route, cache, session, auth, gzip and so on, programmer just need to focus on api
web framework invoke api and render result.
example
package "webapi"
type UserControler struct {
}
//convert []user to json, xml or jsonp accoring to request header:accept
func (*UserControler) Query( name string, age int) []user{
return []User{...}
}
//render html with help of view eigne (html/template, mustache ... )
func (*UserControler) Home( id int) HttpResult{
...
return gomvc.View(...)
}
//render []byte as jpg/png
func (*UserControler) Avator( id int) HttpResult{
...
return gomvc.Image()
}
//render []byte as a a attachment file
func (*UserControler) Download( id int) HttpResult{
...
return gomvc.FileStream(xxx)
}
//HttpResult is a interface