github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/binding/types.go (about)

     1  package binding
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  // ContenTypeBinder are those capable of handling a request type like JSON or XML
     8  type ContenTypeBinder interface {
     9  	BinderFunc() Binder
    10  	ContentTypes() []string
    11  }
    12  
    13  // Binder takes a request and binds it to an interface.
    14  // If there is a problem it should return an error.
    15  type Binder func(*http.Request, interface{}) error
    16  
    17  // CustomTypeDecoder converts a custom type from the request into its exact type.
    18  type CustomTypeDecoder func([]string) (interface{}, error)