binder

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSuitableContentNotFound = errors.New("binder: suitable content not found to parse body")
	ErrMapNotConvertible       = errors.New("binder: map is not convertible to map[string]string or map[string][]string")
	ErrMapNilDestination       = errors.New("binder: map destination is nil and cannot be initialized")
	ErrInvalidDestinationValue = errors.New("binder: invalid destination value")
	ErrUnmatchedBrackets       = errors.New("unmatched brackets")
)

Binder errors

View Source
var (
	HeaderBinder = &headerBinding{}
	CookieBinder = &cookieBinding{}
	QueryBinder  = &queryBinding{}
	FormBinder   = &formBinding{}
	URIBinder    = &uriBinding{}
	XMLBinder    = &xmlBinding{}
	JSONBinder   = &jsonBinding{}
)

Init default binders for Fiber

Functions

func FilterFlags

func FilterFlags(content string) string

FilterFlags returns the media type value by trimming any parameters from a Content-Type header.

func SetParserDecoder

func SetParserDecoder(parserConfig ParserConfig)

SetParserDecoder allow globally change the option of form decoder, update decoderPool

Types

type ParserConfig

type ParserConfig struct {
	// SetAliasTag is ignored: each binding source keeps its own alias tag
	// (query/header/cookie/form/uri), so a single global tag is incompatible
	// with per-source binding.
	SetAliasTag       string
	ParserType        []ParserType
	IgnoreUnknownKeys bool
	ZeroEmpty         bool
}

ParserConfig form decoder config for SetParserDecoder

type ParserType

type ParserType struct {
	CustomType any
	Converter  func(string) reflect.Value
}

ParserType require two element, type and converter for register. Use ParserType with BodyParser for parsing custom type in form data.

Jump to

Keyboard shortcuts

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