MCPcopy
hub / github.com/gofiber/fiber / decoderBuilder

Function decoderBuilder

binder/mapping.go:64–76  ·  view source on GitHub ↗
(aliasTag string, parserConfig ParserConfig)

Source from the content-addressed store, hash-verified

62}
63
64func decoderBuilder(aliasTag string, parserConfig ParserConfig) any {
65 decoder := schema.NewDecoder()
66 decoder.IgnoreUnknownKeys(parserConfig.IgnoreUnknownKeys)
67 // Bake the per-source tag once (pools are keyed per tag); doing it per
68 // request reset the decoder's type cache. ParserConfig.SetAliasTag is not
69 // honored here: one global tag is incompatible with per-source binding.
70 decoder.SetAliasTag(aliasTag)
71 for _, v := range parserConfig.ParserType {
72 decoder.RegisterConverter(reflect.ValueOf(v.CustomType).Interface(), v.Converter)
73 }
74 decoder.ZeroEmpty(parserConfig.ZeroEmpty)
75 return decoder
76}
77
78func init() {
79 decoderPoolMu.Lock()

Callers 3

SetParserDecoderFunction · 0.85
initFunction · 0.85
Test_decoderBuilderFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_decoderBuilderFunction · 0.68