-
Notifications
You must be signed in to change notification settings - Fork 5
/
Type28Enum.go
executable file
·72 lines (62 loc) · 1.46 KB
/
Type28Enum.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 Type28Enum enum
*/
type Type28Enum int
/**
* Value collection for Type28Enum enum
*/
const (
Type28_LOCAL Type28Enum = 1 + iota
Type28_ARCHIVE
)
func (r Type28Enum) MarshalJSON() ([]byte, error) {
s := Type28EnumToValue(r)
return json.Marshal(s)
}
func (r *Type28Enum) UnmarshalJSON(data []byte) error {
var s string
json.Unmarshal(data, &s)
v := Type28EnumFromValue(s)
*r = v
return nil
}
/**
* Converts Type28Enum to its string representation
*/
func Type28EnumToValue(type28Enum Type28Enum) string {
switch type28Enum {
case Type28_LOCAL:
return "local"
case Type28_ARCHIVE:
return "archive"
default:
return "local"
}
}
/**
* Converts Type28Enum Array to its string Array representation
*/
func Type28EnumArrayToValue(type28Enum []Type28Enum) []string {
convArray := make([]string,len( type28Enum))
for i:=0; i<len(type28Enum);i++ {
convArray[i] = Type28EnumToValue(type28Enum[i])
}
return convArray
}
/**
* Converts given value to its enum representation
*/
func Type28EnumFromValue(value string) Type28Enum {
switch value {
case "local":
return Type28_LOCAL
case "archive":
return Type28_ARCHIVE
default:
return Type28_LOCAL
}
}