MCPcopy Index your code
hub / github.com/apache/devlake / DecodeMapStruct

Function DecodeMapStruct

backend/helpers/utils/mapstructure.go:79–95  ·  view source on GitHub ↗

DecodeMapStruct with time.Time and Iso8601Time support

(input interface{}, result interface{}, zeroFields bool)

Source from the content-addressed store, hash-verified

77
78// DecodeMapStruct with time.Time and Iso8601Time support
79func DecodeMapStruct(input interface{}, result interface{}, zeroFields bool) errors.Error {
80 result = models.UnwrapObject(result)
81 decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
82 ZeroFields: zeroFields,
83 DecodeHook: mapstructure.ComposeDecodeHookFunc(DecodeHook),
84 Result: result,
85 WeaklyTypedInput: true,
86 })
87 if err != nil {
88 return errors.Convert(err)
89 }
90
91 if err := decoder.Decode(input); err != nil {
92 return errors.Convert(err)
93 }
94 return errors.Convert(err)
95}
96
97// Decode decodes `source` into `target`. Pass an optional validator to validate the target.
98func Decode(source interface{}, target interface{}, vld *validator.Validate) errors.Error {

Callers 5

TestIso8601TimeFunction · 0.70
DecodeHookFunction · 0.70

Calls 1

ConvertMethod · 0.45