@@ -27,45 +27,28 @@ func NewDecoder(opts ...option[Decoder]) *Decoder {
27
27
return d
28
28
}
29
29
30
- // WithAliasTagDecoderOpt changes the tag used to locate custom field aliases.
31
- // The default tag is "schema".
30
+ // See [Decoder.SetAliasTag] for more information.
32
31
func WithAliasTagDecoderOpt (tag string ) option [Decoder ] {
33
32
return func (d * Decoder ) {
34
33
d .SetAliasTag (tag )
35
34
}
36
35
}
37
36
38
- // WithZeroEmptyDecoderOpt controls the behaviour when the decoder encounters empty values.
39
- // in a map.
40
- // If z is true and a key in the map has the empty string as a value
41
- // then the corresponding struct field is set to the zero value.
42
- // If z is false then empty strings are ignored.
43
- //
44
- // The default value is false, that is empty values do not change
45
- // the value of the struct field.
37
+ // See [Decoder.ZeroEmpty] for more information.
46
38
func WithZeroEmptyDecoderOpt (z bool ) option [Decoder ] {
47
39
return func (d * Decoder ) {
48
40
d .ZeroEmpty (z )
49
41
}
50
42
}
51
43
52
- // WithIgnoreUnknownKeysDecoderOpt controls the behaviour when the decoder
53
- // encounters unknown keys in the map.
54
- // If i is true and an unknown field is encountered, it is ignored. This is
55
- // similar to how unknown keys are handled by encoding/json.
56
- // If i is false then Decode will return an error. Note that any valid keys
57
- // will still be decoded in to the target struct.
58
- //
59
- // To preserve backwards compatibility, the default value is false.
44
+ // See [Decoder.IgnoreUnknownKeys] for more information.
60
45
func WithIgnoreUnknownKeysDecoderOpt (i bool ) option [Decoder ] {
61
46
return func (d * Decoder ) {
62
47
d .IgnoreUnknownKeys (i )
63
48
}
64
49
}
65
50
66
- // WithMaxSizeDecoderOpt limits the size of slices for URL nested arrays or object arrays.
67
- // Choose MaxSize carefully; large values may create many zero-value slice elements.
68
- // Example: "items.100000=apple" would create a slice with 100,000 empty strings.
51
+ // See [Decoder.MaxSize] for more information.
69
52
func WithMaxSizeDecoderOpt (size int ) option [Decoder ] {
70
53
return func (d * Decoder ) {
71
54
d .MaxSize (size )
0 commit comments