mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 11:32:25 -05:00
Update dependencies (#333)
This commit is contained in:
parent
ce22e03f9d
commit
182b4eea73
848 changed files with 377869 additions and 107280 deletions
13
vendor/github.com/mitchellh/mapstructure/mapstructure.go
generated
vendored
13
vendor/github.com/mitchellh/mapstructure/mapstructure.go
generated
vendored
|
|
@ -192,7 +192,7 @@ type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface
|
|||
// source and target types.
|
||||
type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error)
|
||||
|
||||
// DecodeHookFuncRaw is a DecodeHookFunc which has complete access to both the source and target
|
||||
// DecodeHookFuncValue is a DecodeHookFunc which has complete access to both the source and target
|
||||
// values.
|
||||
type DecodeHookFuncValue func(from reflect.Value, to reflect.Value) (interface{}, error)
|
||||
|
||||
|
|
@ -258,6 +258,11 @@ type DecoderConfig struct {
|
|||
// The tag name that mapstructure reads for field names. This
|
||||
// defaults to "mapstructure"
|
||||
TagName string
|
||||
|
||||
// MatchName is the function used to match the map key to the struct
|
||||
// field name or tag. Defaults to `strings.EqualFold`. This can be used
|
||||
// to implement case-sensitive tag values, support snake casing, etc.
|
||||
MatchName func(mapKey, fieldName string) bool
|
||||
}
|
||||
|
||||
// A Decoder takes a raw interface value and turns it into structured
|
||||
|
|
@ -376,6 +381,10 @@ func NewDecoder(config *DecoderConfig) (*Decoder, error) {
|
|||
config.TagName = "mapstructure"
|
||||
}
|
||||
|
||||
if config.MatchName == nil {
|
||||
config.MatchName = strings.EqualFold
|
||||
}
|
||||
|
||||
result := &Decoder{
|
||||
config: config,
|
||||
}
|
||||
|
|
@ -1340,7 +1349,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e
|
|||
continue
|
||||
}
|
||||
|
||||
if strings.EqualFold(mK, fieldName) {
|
||||
if d.config.MatchName(mK, fieldName) {
|
||||
rawMapKey = dataValKey
|
||||
rawMapVal = dataVal.MapIndex(dataValKey)
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue