forms provides a way to parse http Request forms using a schema
The forms package can be added to a project by running:
go get cattlecloud.net/go/forms@latestimport"cattlecloud.net/go/forms"var (
namestringageintaliases []stringworthfloat64password*conceal.Text
)
err:=forms.Parse(request, forms.Schema{
"name": forms.String(&name),
"age": forms.Int(&age),
"aliases": forms.Strings(&aliases),
"worth": forms.Float64(&worth),
"password": forms.Secret(&pword),
})Typically the HTTP request will be given to you in the form of an http handler, e.g.
func(w http.ResponseWriter, r*http.Request) {
_=r.ParseForm()
// now r form data is available to parse
}The cattlecloud.net/go/forms module is open source under the BSD license.