MCPcopy Create free account
hub / github.com/cortexproject/cortex / UnmarshalJSON

Method UnmarshalJSON

pkg/configs/userconfig/config.go:69–83  ·  view source on GitHub ↗

UnmarshalJSON implements json.Unmarshaler.

(data []byte)

Source from the content-addressed store, hash-verified

67
68// UnmarshalJSON implements json.Unmarshaler.
69func (v *RuleFormatVersion) UnmarshalJSON(data []byte) error {
70 var s string
71 if err := json.Unmarshal(data, &s); err != nil {
72 return err
73 }
74 switch s {
75 case "1":
76 *v = RuleFormatV1
77 case "2":
78 *v = RuleFormatV2
79 default:
80 return fmt.Errorf("unknown rule format version %q", string(data))
81 }
82 return nil
83}
84
85// UnmarshalYAML implements yaml.Unmarshaler.
86func (v *RuleFormatVersion) UnmarshalYAML(unmarshal func(any) error) error {

Callers

nothing calls this directly

Calls 1

UnmarshalMethod · 0.45

Tested by

no test coverage detected