MCPcopy
hub / github.com/apache/devlake / DecodeMapStruct

Function DecodeMapStruct

backend/helpers/pluginhelper/api/mapstructure.go:108–123  ·  view source on GitHub ↗

DecodeMapStruct with time.Time and Iso8601Time support

(input map[string]interface{}, result interface{}, zeroFields bool)

Source from the content-addressed store, hash-verified

106
107// DecodeMapStruct with time.Time and Iso8601Time support
108func DecodeMapStruct(input map[string]interface{}, result interface{}, zeroFields bool) errors.Error {
109 result = models.UnwrapObject(result)
110 decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
111 ZeroFields: zeroFields,
112 DecodeHook: mapstructure.ComposeDecodeHookFunc(defaultCustomDecoderHooks...),
113 Result: result,
114 WeaklyTypedInput: true,
115 })
116 if err != nil {
117 return errors.Convert(err)
118 }
119 if err := decoder.Decode(input); err != nil {
120 return errors.Convert(err)
121 }
122 return errors.Convert(err)
123}
124
125// Decode decodes `source` into `target`. Pass an optional validator to validate the target.
126func Decode(source interface{}, target interface{}, vld *validator.Validate) errors.Error {

Callers 10

PostMethod · 0.70
PatchModelMethod · 0.70
PutMultipleCbMethod · 0.70
GetMergedConnectionMethod · 0.70
PutMethod · 0.70
CreateMethod · 0.70
UpdateMethod · 0.70
UpdateScopeMethod · 0.70

Calls 1

ConvertMethod · 0.45