Documentation
¶
Overview ¶
Package reflectd provides configurable HTTP form body to struct decoder that depends on Gorilla's schema reflection package.
Index ¶
- type Decoder
- type Option
- func WithCookieValues(names ...string) Option
- func WithDefaultMemoryLimitOfOneThirdOfReadLimit() Option
- func WithDefaultReadLimitOf10MB() Option
- func WithExtractors(exs ...extract.RequestValueExtractor) Option
- func WithHeaderValues(names ...string) Option
- func WithMemoryLimit(upto int64) Option
- func WithOptions(withOptions ...Option) Option
- func WithPathValues(names ...string) Option
- func WithQueryValues(names ...string) Option
- func WithReadLimit(upto int64) Option
- func WithSessionValues(keys ...string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder provides configurable HTTP form body decoding that depends on Gorilla's schema reflection package.
func NewDecoder ¶
func (*Decoder) DecodeJSON ¶ added in v0.1.0
func (*Decoder) DecodeMultiPart ¶ added in v0.1.0
type Option ¶
type Option func(*options) error
Option configures new [Decoder]s.
func WithCookieValues ¶ added in v0.0.6
WithCookieValues adds a [CookieValueExtractor] to a Decoder.
func WithDefaultMemoryLimitOfOneThirdOfReadLimit ¶
func WithDefaultMemoryLimitOfOneThirdOfReadLimit() Option
WithDefaultMemoryLimitOfOneThirdOfReadLimit contrains memory limit to one third of the read limit when WithMemoryLimit option is not used. Use WithReadLimit option to adjust the read limit.
func WithDefaultReadLimitOf10MB ¶
func WithDefaultReadLimitOf10MB() Option
WithDefaultReadLimitOf10MB enforces the standard library convention when WithReadLimit is not used.
func WithExtractors ¶
func WithExtractors(exs ...extract.RequestValueExtractor) Option
WithExtractors adds [extract.RequestValueExtractor]s to a Decoder. The order of extractors determines their precedence.
func WithHeaderValues ¶
WithHeaderValues adds a [HeaderValueExtractor] to a Decoder.
func WithMemoryLimit ¶
WithMemoryLimit constrains system memory usage when decoding mixed multipart forms, which typically include file uploads. When the memory limit is exceeded, the excess data is written to disk. Higher limit speeds up handling file uploads.
func WithOptions ¶
WithOptions combines several [Option]s into one.
func WithPathValues ¶
WithPathValues adds a [PathValueExtractor] to a Decoder.
func WithQueryValues ¶
WithQueryValues adds a [QueryValueExtractor] to a Decoder.
func WithReadLimit ¶
WithReadLimit contrains acceptable [request.Body] size.
func WithSessionValues ¶ added in v0.0.14
WithSessionValues adds a extract.SessionValueExtractor to a Decoder.