-
Notifications
You must be signed in to change notification settings - Fork 2
/
schwachlastfaehigkeit_jsonenums.go
56 lines (49 loc) · 1.63 KB
/
schwachlastfaehigkeit_jsonenums.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Code generated by jsonenums --type Schwachlastfaehigkeit; DO NOT EDIT.
package schwachlastfaehigkeit
import (
"encoding/json"
"fmt"
)
var (
_SchwachlastfaehigkeitNameToValue = map[string]Schwachlastfaehigkeit{
"SCHWACHLASTFAEHIG": SCHWACHLASTFAEHIG,
"NICHT_SCHWACHLASTFAEHIG": NICHT_SCHWACHLASTFAEHIG,
}
_SchwachlastfaehigkeitValueToName = map[Schwachlastfaehigkeit]string{
SCHWACHLASTFAEHIG: "SCHWACHLASTFAEHIG",
NICHT_SCHWACHLASTFAEHIG: "NICHT_SCHWACHLASTFAEHIG",
}
)
func init() {
var v Schwachlastfaehigkeit
if _, ok := interface{}(v).(fmt.Stringer); ok {
_SchwachlastfaehigkeitNameToValue = map[string]Schwachlastfaehigkeit{
interface{}(SCHWACHLASTFAEHIG).(fmt.Stringer).String(): SCHWACHLASTFAEHIG,
interface{}(NICHT_SCHWACHLASTFAEHIG).(fmt.Stringer).String(): NICHT_SCHWACHLASTFAEHIG,
}
}
}
// MarshalJSON is generated so Schwachlastfaehigkeit satisfies json.Marshaler.
func (r Schwachlastfaehigkeit) MarshalJSON() ([]byte, error) {
if s, ok := interface{}(r).(fmt.Stringer); ok {
return json.Marshal(s.String())
}
s, ok := _SchwachlastfaehigkeitValueToName[r]
if !ok {
return nil, fmt.Errorf("invalid Schwachlastfaehigkeit: %d", r)
}
return json.Marshal(s)
}
// UnmarshalJSON is generated so Schwachlastfaehigkeit satisfies json.Unmarshaler.
func (r *Schwachlastfaehigkeit) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("Schwachlastfaehigkeit should be a string, got %s", data)
}
v, ok := _SchwachlastfaehigkeitNameToValue[s]
if !ok {
return fmt.Errorf("invalid Schwachlastfaehigkeit %q", s)
}
*r = v
return nil
}