MCPcopy Create free account
hub / github.com/rilldata/rill / WeakDecode

Function WeakDecode

runtime/pkg/mapstructureutil/mapstructureutil.go:10–24  ·  view source on GitHub ↗

WeakDecode is similar to mapstructure.WeakDecode, but it also supports decoding RFC3339Nano-formatted timestamp strings to time.Time.

(input, output any)

Source from the content-addressed store, hash-verified

8
9// WeakDecode is similar to mapstructure.WeakDecode, but it also supports decoding RFC3339Nano-formatted timestamp strings to time.Time.
10func WeakDecode(input, output any) error {
11 config := &mapstructure.DecoderConfig{
12 DecodeHook: mapstructure.StringToTimeHookFunc(time.RFC3339Nano),
13 Metadata: nil,
14 Result: output,
15 WeaklyTypedInput: true,
16 }
17
18 decoder, err := mapstructure.NewDecoder(config)
19 if err != nil {
20 return err
21 }
22
23 return decoder.Decode(input)
24}
25
26// WeakDecodeWithWarnings is like WeakDecode but also returns any unused keys from the input.
27func WeakDecodeWithWarnings(input, output any) ([]string, error) {

Callers 15

resolveTimeRangesFunction · 0.92
TestAnalystOpenRTBFunction · 0.92
newLegacyMetricsFunction · 0.92
newAnnotationsResolverFunction · 0.92
newAPIFunction · 0.92
newSQLFunction · 0.92
newTextFunction · 0.92
newResourceStatusFunction · 0.92
newMetricsFunction · 0.92
newMetricsSQLFunction · 0.92

Calls 1

DecodeMethod · 0.45

Tested by 4

TestAnalystOpenRTBFunction · 0.74
TestProjectStorageFunction · 0.74
TestStrToTimeFunction · 0.68
TestStrToTimePtrFunction · 0.68