-
Notifications
You must be signed in to change notification settings - Fork 5
/
Type29Enum.go
executable file
·72 lines (62 loc) · 1.46 KB
/
Type29Enum.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
package models
import(
"encoding/json"
)
/**
* Type definition for Type29Enum enum
*/
type Type29Enum int
/**
* Value collection for Type29Enum enum
*/
const (
Type29_KREGULAR Type29Enum = 1 + iota
Type29_KRPO
)
func (r Type29Enum) MarshalJSON() ([]byte, error) {
s := Type29EnumToValue(r)
return json.Marshal(s)
}
func (r *Type29Enum) UnmarshalJSON(data []byte) error {
var s string
json.Unmarshal(data, &s)
v := Type29EnumFromValue(s)
*r = v
return nil
}
/**
* Converts Type29Enum to its string representation
*/
func Type29EnumToValue(type29Enum Type29Enum) string {
switch type29Enum {
case Type29_KREGULAR:
return "kRegular"
case Type29_KRPO:
return "kRPO"
default:
return "kRegular"
}
}
/**
* Converts Type29Enum Array to its string Array representation
*/
func Type29EnumArrayToValue(type29Enum []Type29Enum) []string {
convArray := make([]string,len( type29Enum))
for i:=0; i<len(type29Enum);i++ {
convArray[i] = Type29EnumToValue(type29Enum[i])
}
return convArray
}
/**
* Converts given value to its enum representation
*/
func Type29EnumFromValue(value string) Type29Enum {
switch value {
case "kRegular":
return Type29_KREGULAR
case "kRPO":
return Type29_KRPO
default:
return Type29_KREGULAR
}
}