MCPcopy Create free account
hub / github.com/prometheus/common / UnmarshalJSON

Method UnmarshalJSON

model/value_type.go:47–67  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

45}
46
47func (et *ValueType) UnmarshalJSON(b []byte) error {
48 var s string
49 if err := json.Unmarshal(b, &s); err != nil {
50 return err
51 }
52 switch s {
53 case "<ValNone>":
54 *et = ValNone
55 case "scalar":
56 *et = ValScalar
57 case "vector":
58 *et = ValVector
59 case "matrix":
60 *et = ValMatrix
61 case "string":
62 *et = ValString
63 default:
64 return fmt.Errorf("unknown value type %q", s)
65 }
66 return nil
67}
68
69func (e ValueType) String() string {
70 switch e {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected