Skip to content

Commit 138fd98

Browse files
committed
Use links instead of copying docstring
1 parent 187dc84 commit 138fd98

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

decoder.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,28 @@ func NewDecoder(opts ...option[Decoder]) *Decoder {
2727
return d
2828
}
2929

30-
// WithAliasTagDecoderOpt changes the tag used to locate custom field aliases.
31-
// The default tag is "schema".
30+
// See [Decoder.SetAliasTag] for more information.
3231
func WithAliasTagDecoderOpt(tag string) option[Decoder] {
3332
return func(d *Decoder) {
3433
d.SetAliasTag(tag)
3534
}
3635
}
3736

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.
4638
func WithZeroEmptyDecoderOpt(z bool) option[Decoder] {
4739
return func(d *Decoder) {
4840
d.ZeroEmpty(z)
4941
}
5042
}
5143

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.
6045
func WithIgnoreUnknownKeysDecoderOpt(i bool) option[Decoder] {
6146
return func(d *Decoder) {
6247
d.IgnoreUnknownKeys(i)
6348
}
6449
}
6550

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.
6952
func WithMaxSizeDecoderOpt(size int) option[Decoder] {
7053
return func(d *Decoder) {
7154
d.MaxSize(size)

encoder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ func NewEncoder(opts ...option[Encoder]) *Encoder {
2424
return e
2525
}
2626

27-
// WithAliasTagEncoderOpt changes the tag used to locate custom field aliases.
28-
// The default tag is "schema".
27+
// See [Encoder.SetAliasTag] for more information.
2928
func WithAliasTagEncoderOpt(tag string) option[Encoder] {
3029
return func(e *Encoder) {
3130
e.SetAliasTag(tag)

0 commit comments

Comments
 (0)