-
Notifications
You must be signed in to change notification settings - Fork 2
/
enum_lifesustainingtreatment.go
77 lines (63 loc) · 2.01 KB
/
enum_lifesustainingtreatment.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Code generated by "enumerator -type LifeSustainingTreatment -linecomment -trimprefix -empty"; DO NOT EDIT.
package actor
import (
"fmt"
"strconv"
)
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[LifeSustainingTreatmentOptionA-1]
_ = x[LifeSustainingTreatmentOptionB-2]
}
const _LifeSustainingTreatment_name = "option-aoption-b"
var _LifeSustainingTreatment_index = [...]uint8{0, 8, 16}
func (i LifeSustainingTreatment) String() string {
if i == 0 {
return ""
}
i -= 1
if i >= LifeSustainingTreatment(len(_LifeSustainingTreatment_index)-1) {
return "LifeSustainingTreatment(" + strconv.FormatInt(int64(i+1), 10) + ")"
}
return _LifeSustainingTreatment_name[_LifeSustainingTreatment_index[i]:_LifeSustainingTreatment_index[i+1]]
}
func (i LifeSustainingTreatment) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
func (i *LifeSustainingTreatment) UnmarshalText(text []byte) error {
val, err := ParseLifeSustainingTreatment(string(text))
if err != nil {
return err
}
*i = val
return nil
}
func (i LifeSustainingTreatment) IsOptionA() bool {
return i == LifeSustainingTreatmentOptionA
}
func (i LifeSustainingTreatment) IsOptionB() bool {
return i == LifeSustainingTreatmentOptionB
}
func ParseLifeSustainingTreatment(s string) (LifeSustainingTreatment, error) {
switch s {
case "option-a":
return LifeSustainingTreatmentOptionA, nil
case "option-b":
return LifeSustainingTreatmentOptionB, nil
default:
return LifeSustainingTreatment(0), fmt.Errorf("invalid LifeSustainingTreatment '%s'", s)
}
}
type LifeSustainingTreatmentOptions struct {
OptionA LifeSustainingTreatment
OptionB LifeSustainingTreatment
}
var LifeSustainingTreatmentValues = LifeSustainingTreatmentOptions{
OptionA: LifeSustainingTreatmentOptionA,
OptionB: LifeSustainingTreatmentOptionB,
}
func (i LifeSustainingTreatment) Empty() bool {
return i == LifeSustainingTreatment(0)
}