buffalo: github.com/gobuffalo/buffalo/binding Index | Files

package binding

import "github.com/gobuffalo/buffalo/binding"


Package Files

bindable.go binding.go file.go


var MaxFileMemory int64 = 5 * 1024 * 1024

MaxFileMemory can be used to set the maximum size, in bytes, for files to be stored in memory during uploaded for multipart requests. See https://golang.org/pkg/net/http/#Request.ParseMultipartForm for more information on how this impacts file uploads.

func Exec Uses

func Exec(req *http.Request, value interface{}) error

Exec will bind the interface to the request.Body. The type of binding is dependent on the "Content-Type" for the request. If the type is "application/json" it will use "json.NewDecoder". If the type is "application/xml" it will use "xml.NewDecoder". The default binder is "https://github.com/monoculum/formam".

func Register Uses

func Register(contentType string, fn Binder)

Register maps a request Content-Type (application/json) to a Binder.

func RegisterCustomDecoder Uses

func RegisterCustomDecoder(fn CustomTypeDecoder, types []interface{}, fields []interface{})

RegisterCustomDecoder allows to define custom type decoders.

func RegisterTimeFormats Uses

func RegisterTimeFormats(layouts ...string)

RegisterTimeFormats allows to add custom time layouts that the binder will be able to use for decoding.

type Bindable Uses

type Bindable interface {
    Bind(*http.Request) error

Bindable when implemented, on a type will override any Binders that have been configured when using buffalo#Context.Bind

type Binder Uses

type Binder func(*http.Request, interface{}) error

Binder takes a request and binds it to an interface. If there is a problem it should return an error.

type CustomTypeDecoder Uses

type CustomTypeDecoder func([]string) (interface{}, error)

CustomTypeDecoder converts a custom type from the request insto its exact type.

type File Uses

type File struct {

File holds information regarding an uploaded file

func (File) String Uses

func (f File) String() string

func (File) Valid Uses

func (f File) Valid() bool

Valid if there is an actual uploaded file

Package binding imports 12 packages (graph) and is imported by 15 packages. Updated 2019-07-27. Refresh now. Tools for package owners.