Documentation ¶
Index ¶
- Constants
- Variables
- func FilterFlags(content string) string
- func GetFromThePool[T any](pool *sync.Pool) T
- func PutToThePool[T any](pool *sync.Pool, binder T)
- func SetParserDecoder(parserConfig ParserConfig)
- type CBORBinding
- type CookieBinding
- type FormBinding
- type HeaderBinding
- type JSONBinding
- type ParserConfig
- type ParserType
- type QueryBinding
- type RespHeaderBinding
- type URIBinding
- type XMLBinding
Constants ¶
const MIMEMultipartForm string = "multipart/form-data"
Variables ¶
var ( ErrSuitableContentNotFound = errors.New("binder: suitable content not found to parse body") ErrMapNotConvertable = errors.New("binder: map is not convertable to map[string]string or map[string][]string") )
Binder errors
var CBORBinderPool = sync.Pool{ New: func() any { return &CBORBinding{} }, }
var CookieBinderPool = sync.Pool{ New: func() any { return &CookieBinding{} }, }
var FormBinderPool = sync.Pool{ New: func() any { return &FormBinding{} }, }
var HeaderBinderPool = sync.Pool{ New: func() any { return &HeaderBinding{} }, }
var JSONBinderPool = sync.Pool{ New: func() any { return &JSONBinding{} }, }
var QueryBinderPool = sync.Pool{ New: func() any { return &QueryBinding{} }, }
var RespHeaderBinderPool = sync.Pool{ New: func() any { return &RespHeaderBinding{} }, }
var URIBinderPool = sync.Pool{ New: func() any { return &URIBinding{} }, }
var XMLBinderPool = sync.Pool{ New: func() any { return &XMLBinding{} }, }
Functions ¶
func FilterFlags ¶
Get content type from content type header
func GetFromThePool ¶
func PutToThePool ¶
func SetParserDecoder ¶
func SetParserDecoder(parserConfig ParserConfig)
SetParserDecoder allow globally change the option of form decoder, update decoderPool
Types ¶
type CBORBinding ¶
type CBORBinding struct {
CBORDecoder utils.CBORUnmarshal
}
CBORBinding is the CBOR binder for CBOR request body.
type CookieBinding ¶
type CookieBinding struct {
EnableSplitting bool
}
CookieBinding is the cookie binder for cookie request body.
func (*CookieBinding) Bind ¶
func (b *CookieBinding) Bind(req *fasthttp.Request, out any) error
Bind parses the request cookie and returns the result.
func (*CookieBinding) Reset ¶
func (b *CookieBinding) Reset()
Reset resets the CookieBinding binder.
type FormBinding ¶
type FormBinding struct {
EnableSplitting bool
}
FormBinding is the form binder for form request body.
type HeaderBinding ¶
type HeaderBinding struct {
EnableSplitting bool
}
v is the header binder for header request body.
func (*HeaderBinding) Bind ¶
func (b *HeaderBinding) Bind(req *fasthttp.Request, out any) error
Bind parses the request header and returns the result.
func (*HeaderBinding) Reset ¶
func (b *HeaderBinding) Reset()
Reset resets the HeaderBinding binder.
type JSONBinding ¶
type JSONBinding struct {
JSONDecoder utils.JSONUnmarshal
}
JSONBinding is the JSON binder for JSON request body.
type ParserConfig ¶
type ParserConfig struct { SetAliasTag string ParserType []ParserType IgnoreUnknownKeys bool ZeroEmpty bool }
ParserConfig form decoder config for SetParserDecoder
type ParserType ¶
ParserType require two element, type and converter for register. Use ParserType with BodyParser for parsing custom type in form data.
type QueryBinding ¶
type QueryBinding struct {
EnableSplitting bool
}
QueryBinding is the query binder for query request body.
type RespHeaderBinding ¶
type RespHeaderBinding struct {
EnableSplitting bool
}
RespHeaderBinding is the respHeader binder for response header.
func (*RespHeaderBinding) Bind ¶
func (b *RespHeaderBinding) Bind(resp *fasthttp.Response, out any) error
Bind parses the response header and returns the result.
func (*RespHeaderBinding) Name ¶
func (*RespHeaderBinding) Name() string
Name returns the binding name.
func (*RespHeaderBinding) Reset ¶
func (b *RespHeaderBinding) Reset()
Reset resets the RespHeaderBinding binder.
type URIBinding ¶
type URIBinding struct{}
uriBinding is the URI binder for URI parameters.
type XMLBinding ¶
type XMLBinding struct {
XMLDecoder utils.XMLUnmarshal
}
XMLBinding is the XML binder for XML request body.