Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxMultipartMem = int64(1024 * 1024)
DefaultMaxMultipartMem is the amount of memory that is allowed to be used by multipart form reading
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface {
Decode(v interface{}) error
}
Deocder can be used for actual decoding into a certain value
type Encoder ¶
type Encoder interface {
Encode(v interface{}) error
}
Encoder can be used for actual value encoding
type FormDecoder ¶
type FormDecoder struct {
// contains filtered or unexported fields
}
FormDecoder implements decoder for forms
func (*FormDecoder) Decode ¶
func (d *FormDecoder) Decode(v interface{}) (err error)
Decode will attempt to decode form data from the request body into the provided value.
type FormDecoding ¶
type FormDecoding struct {
// contains filtered or unexported fields
}
FormDecoding can be used to decode multipart/form-data or urlencoded request bodies.
func NewFormDecoding ¶
func NewFormDecoding(d URLValuesDecoder) *FormDecoding
NewFormDecoding inits a new decoding
func (FormDecoding) Accepts ¶
func (d FormDecoding) Accepts() []string
Accepts returns what content-types this decoder can handle
func (FormDecoding) Decoder ¶
func (d FormDecoding) Decoder(r *http.Request) Decoder
Decoder creates an actual decoder for the request
func (*FormDecoding) SetMaxMultipartMemory ¶
func (d *FormDecoding) SetMaxMultipartMemory(nbytes int64) *FormDecoding
SetMaxMultipartMemory changes the max amount of allowed memory for multipart decoding
type HTMLEncoder ¶
type HTMLEncoder struct {
// contains filtered or unexported fields
}
HTMLEncoder allows for actual encoding
func (HTMLEncoder) Encode ¶
func (e HTMLEncoder) Encode(v interface{}) error
Encode the provided value
type HTMLEncoding ¶
type HTMLEncoding struct {
// contains filtered or unexported fields
}
HTMLEncoding will write html by executing html/template.Templates
func NewHTMLEncoding ¶
func NewHTMLEncoding(view *template.Template) *HTMLEncoding
NewHTMLEncoding provides the ability to render the provided template or any named sub-template in the namespace
func (HTMLEncoding) Encoder ¶
func (e HTMLEncoding) Encoder(w io.Writer) Encoder
Encoder return an encoder
func (HTMLEncoding) Produces ¶
func (e HTMLEncoding) Produces() string
Produces returns what conten type this encoding produces
func (*HTMLEncoding) SetProduces ¶
func (e *HTMLEncoding) SetProduces(p string) *HTMLEncoding
SetProduces will onvewrite what content type the encoding produces
type JSONDecoding ¶
type JSONDecoding struct {
// contains filtered or unexported fields
}
JSONDecoding defines a decoding that produces json
func (JSONDecoding) Accepts ¶
func (d JSONDecoding) Accepts() []string
Accepts defines what content types this decoder can decode
func (JSONDecoding) Decoder ¶
func (d JSONDecoding) Decoder(r *http.Request) Decoder
Decoder creates the actual decoding
func (*JSONDecoding) SetAccepts ¶
func (d *JSONDecoding) SetAccepts(accs []string) *JSONDecoding
SetAccepts allows overwriting what content-types will be decoded
type JSONEncoding ¶
type JSONEncoding struct {
// contains filtered or unexported fields
}
JSONEncoding encodes json
func NewJSONEncoding ¶
func NewJSONEncoding() JSONEncoding
NewJSONEncoding creates a new JSON encoder
func (JSONEncoding) Encoder ¶
func (d JSONEncoding) Encoder(r io.Writer) Encoder
Encoder creates an anctual json encoder
func (JSONEncoding) Produces ¶
func (e JSONEncoding) Produces() string
Produces defines what content type the encoding encodes to
func (*JSONEncoding) SetProduces ¶
func (e *JSONEncoding) SetProduces(s string) *JSONEncoding
SetProduces overwrites the content-type this encoder will produce
type TemplatedOutput ¶
type TemplatedOutput interface {
Template() string
}
TemplatedOutput can be implemented by outputs to render a named sub-template in the namespace provided in the HTMLEncoding constructor
type URLValuesDecoder ¶
URLValuesDecoder can be implemented to automate the decoding of url.Values
type XMLDecoding ¶
type XMLDecoding struct {
// contains filtered or unexported fields
}
XML Decoding allows deserialization of xml request bodies
func NewXMLDecoding ¶
func NewXMLDecoding() *XMLDecoding
NewXMLDecoding will init the a new xml decoding
func (XMLDecoding) Accepts ¶
func (d XMLDecoding) Accepts() []string
Accepts returns what content types this decoding accepts
func (XMLDecoding) Decoder ¶
func (d XMLDecoding) Decoder(r *http.Request) Decoder
Decoder creates an actual decoder that can be used
func (*XMLDecoding) SetAccepts ¶
func (d *XMLDecoding) SetAccepts(s []string) *XMLDecoding
SetAccepts changes what this decoding accepts
type XMLEncoding ¶
type XMLEncoding struct {
// contains filtered or unexported fields
}
XMLEncoding describes response encoding using xml
func (XMLEncoding) Encoder ¶
func (d XMLEncoding) Encoder(r io.Writer) Encoder
Encoder will encode from the provides
func (XMLEncoding) Produces ¶
func (e XMLEncoding) Produces() string
Produces returns what content type this encoding produces
func (*XMLEncoding) SetProduces ¶
func (e *XMLEncoding) SetProduces(p string) *XMLEncoding
SetProduces will set what is produced