formdata

package module
v0.0.0-...-edc41fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2015 License: MIT Imports: 9 Imported by: 1

README

formdata

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongValue happens when there is a wrong value for the type.
	ErrWrongValue = "wrong value"

	// TagName is the tag used to register custom names for field.
	TagName = "formdata"
)

Functions

func Unmarshal

func Unmarshal(request *http.Request, out interface{}) error

Unmarshal takes the request, parses the multipart form data and fill the object out. Here is a complete example:

type Foo struct {
	Name string `formdata:"name"`
	Image *multipart.FileHeader `formdata:"image"`
}

foo := &Foo{}
if err := formdata.Unmarshal(request, out); err != nil {
	// deal with error
}

Types

type Unmarshaler

type Unmarshaler interface {
	UnmarshalFormData(string) error
}

Unmarshaler is the interface to implements to deal with custom unmarshaling of form data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL