bind

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Form = Generic(formC)

Form constructs middleware that parses request form according to provided model and injects parsed object into context

View Source
var JSON = Generic(jsonC)

JSON constructs middleware that parses request body according to provided model and injects parsed object into context

Functions

func Generic

func Generic(dc Constructor) func(interface{}) noodle.Middleware

Generic is a middleware factory for request binding. Accepts Constructor and returns binder for model

func Get added in v2.0.10

func Get(r *http.Request) (val interface{}, err error)

Get extracts data parsed from upstream Bind operation, along with the decode error.

func GetData

func GetData(r *http.Request) (res interface{})

GetData extracts data parsed from upstream Bind operation, discarding decoding error. Deprecated in favor of Get() function.

Types

type Constructor

type Constructor func(io.Reader) Decoder

Constructor is a generic function modelled after json.NewDecoder

type Decoder

type Decoder interface {
	Decode(interface{}) error
}

Decoder populates target object with data from request body

Jump to

Keyboard shortcuts

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