@@ -161,10 +161,11 @@ import (
161
161
// data transformations. See "DecodeHook" in the DecoderConfig
162
162
// struct.
163
163
//
164
- // The type should be DecodeHookFuncType or DecodeHookFuncKind.
165
- // Either is accepted. Types are a superset of Kinds (Types can return
166
- // Kinds) and are generally a richer thing to use, but Kinds are simpler
167
- // if you only need those.
164
+ // The type must be one of DecodeHookFuncType, DecodeHookFuncKind, or
165
+ // DecodeHookFuncValue.
166
+ // Values are a superset of Types (Values can return types), and Types are a
167
+ // superset of Kinds (Types can return Kinds) and are generally a richer thing
168
+ // to use, but Kinds are simpler if you only need those.
168
169
//
169
170
// The reason DecodeHookFunc is multi-typed is for backwards compatibility:
170
171
// we started with Kinds and then realized Types were the better solution,
@@ -189,10 +190,13 @@ type DecodeHookFuncValue func(from reflect.Value, to reflect.Value) (interface{}
189
190
type DecoderConfig struct {
190
191
// DecodeHook, if set, will be called before any decoding and any
191
192
// type conversion (if WeaklyTypedInput is on). This lets you modify
192
- // the values before they're set down onto the resulting struct.
193
+ // the values before they're set down onto the resulting struct. The
194
+ // DecodeHook is called for every map and value in the input. This means
195
+ // that if a struct has embedded fields with squash tags the decode hook
196
+ // is called only once with all of the input data, not once for each
197
+ // embedded struct.
193
198
//
194
- // If an error is returned, the entire decode will fail with that
195
- // error.
199
+ // If an error is returned, the entire decode will fail with that error.
196
200
DecodeHook DecodeHookFunc
197
201
198
202
// If ErrorUnused is true, then it is an error for there to exist
0 commit comments