Skip to content

cattlecloud/forms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forms

Go Reference License Build

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 (
  name string
  age  int
)

err := forms.Parse(request, forms.Schema{
  "NAME": forms.String(&name),
  "AGE":  forms.Int(&age),
})
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

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •