Golang Gorilla Schema
func readForm(r *http.Request) *User {
r.ParseForm()
user := new(User)
decoder := schema.NewDecoder()
decodeErr := decoder.Decode(user, r.PostForm)
if decodeErr != nil {
log.Println("Error mapping parsed form data to struct : ", decodeErr)
}
return user
}
First of all, learn about Golang HTML Forms then use gorilla schema.
Learn and get the full source code to get the form data using the Gorilla Schema in Golang.
Top comments (0)