/
operationtype_enumer.go
118 lines (105 loc) · 4.5 KB
/
operationtype_enumer.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Code generated by "enumer -type=OperationType"; DO NOT EDIT.
package dto
import (
"fmt"
"strings"
)
const (
_OperationTypeName_0 = "UndefinedOperationType"
_OperationTypeLowerName_0 = "undefinedoperationtype"
_OperationTypeName_1 = "QuickTransferOperationTypeQuickTransferAllOperationTypeCreateSafeTransferOperationTypeCreateSafeTransferAllOperationTypeCreateWpcSafeTransferOperationTypeCreateWpcSafeTransferAllOperationType"
_OperationTypeLowerName_1 = "quicktransferoperationtypequicktransferalloperationtypecreatesafetransferoperationtypecreatesafetransferalloperationtypecreatewpcsafetransferoperationtypecreatewpcsafetransferalloperationtype"
_OperationTypeName_2 = "CreateAssetboxOperationType"
_OperationTypeLowerName_2 = "createassetboxoperationtype"
)
var (
_OperationTypeIndex_0 = [...]uint8{0, 22}
_OperationTypeIndex_1 = [...]uint8{0, 26, 55, 86, 120, 154, 191}
_OperationTypeIndex_2 = [...]uint8{0, 27}
)
func (i OperationType) String() string {
switch {
case i == 0:
return _OperationTypeName_0
case 101 <= i && i <= 106:
i -= 101
return _OperationTypeName_1[_OperationTypeIndex_1[i]:_OperationTypeIndex_1[i+1]]
case i == 201:
return _OperationTypeName_2
default:
return fmt.Sprintf("OperationType(%d)", i)
}
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _OperationTypeNoOp() {
var x [1]struct{}
_ = x[UndefinedOperationType-(0)]
_ = x[QuickTransferOperationType-(101)]
_ = x[QuickTransferAllOperationType-(102)]
_ = x[CreateSafeTransferOperationType-(103)]
_ = x[CreateSafeTransferAllOperationType-(104)]
_ = x[CreateWpcSafeTransferOperationType-(105)]
_ = x[CreateWpcSafeTransferAllOperationType-(106)]
_ = x[CreateAssetboxOperationType-(201)]
}
var _OperationTypeValues = []OperationType{UndefinedOperationType, QuickTransferOperationType, QuickTransferAllOperationType, CreateSafeTransferOperationType, CreateSafeTransferAllOperationType, CreateWpcSafeTransferOperationType, CreateWpcSafeTransferAllOperationType, CreateAssetboxOperationType}
var _OperationTypeNameToValueMap = map[string]OperationType{
_OperationTypeName_0[0:22]: UndefinedOperationType,
_OperationTypeLowerName_0[0:22]: UndefinedOperationType,
_OperationTypeName_1[0:26]: QuickTransferOperationType,
_OperationTypeLowerName_1[0:26]: QuickTransferOperationType,
_OperationTypeName_1[26:55]: QuickTransferAllOperationType,
_OperationTypeLowerName_1[26:55]: QuickTransferAllOperationType,
_OperationTypeName_1[55:86]: CreateSafeTransferOperationType,
_OperationTypeLowerName_1[55:86]: CreateSafeTransferOperationType,
_OperationTypeName_1[86:120]: CreateSafeTransferAllOperationType,
_OperationTypeLowerName_1[86:120]: CreateSafeTransferAllOperationType,
_OperationTypeName_1[120:154]: CreateWpcSafeTransferOperationType,
_OperationTypeLowerName_1[120:154]: CreateWpcSafeTransferOperationType,
_OperationTypeName_1[154:191]: CreateWpcSafeTransferAllOperationType,
_OperationTypeLowerName_1[154:191]: CreateWpcSafeTransferAllOperationType,
_OperationTypeName_2[0:27]: CreateAssetboxOperationType,
_OperationTypeLowerName_2[0:27]: CreateAssetboxOperationType,
}
var _OperationTypeNames = []string{
_OperationTypeName_0[0:22],
_OperationTypeName_1[0:26],
_OperationTypeName_1[26:55],
_OperationTypeName_1[55:86],
_OperationTypeName_1[86:120],
_OperationTypeName_1[120:154],
_OperationTypeName_1[154:191],
_OperationTypeName_2[0:27],
}
// OperationTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func OperationTypeString(s string) (OperationType, error) {
if val, ok := _OperationTypeNameToValueMap[s]; ok {
return val, nil
}
s = strings.ToLower(s)
if val, ok := _OperationTypeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to OperationType values", s)
}
// OperationTypeValues returns all values of the enum
func OperationTypeValues() []OperationType {
return _OperationTypeValues
}
// OperationTypeStrings returns a slice of all String values of the enum
func OperationTypeStrings() []string {
strs := make([]string, len(_OperationTypeNames))
copy(strs, _OperationTypeNames)
return strs
}
// IsAOperationType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i OperationType) IsAOperationType() bool {
for _, v := range _OperationTypeValues {
if i == v {
return true
}
}
return false
}