Skip to content

Repository files navigation

forms

Go ReferenceLicenseBuild

forms provides a way to parse http Request forms using a schema

Getting Started

The forms package can be added to a project by running:

go get cattlecloud.net/go/forms@latest
import"cattlecloud.net/go/forms"

Examples

parsing http request
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),
})
about requests

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
}

License

The cattlecloud.net/go/forms module is open source under the BSD license.

About

forms is a Go package with generics for extracting values from HTTP Forms using a declarative schema

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages