-
Notifications
You must be signed in to change notification settings - Fork 2
/
enum_evidencedelivery.go
77 lines (63 loc) · 1.6 KB
/
enum_evidencedelivery.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 EvidenceDelivery -linecomment -empty"; DO NOT EDIT.
package pay
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[Upload-1]
_ = x[Post-2]
}
const _EvidenceDelivery_name = "uploadpost"
var _EvidenceDelivery_index = [...]uint8{0, 6, 10}
func (i EvidenceDelivery) String() string {
if i == 0 {
return ""
}
i -= 1
if i >= EvidenceDelivery(len(_EvidenceDelivery_index)-1) {
return "EvidenceDelivery(" + strconv.FormatInt(int64(i+1), 10) + ")"
}
return _EvidenceDelivery_name[_EvidenceDelivery_index[i]:_EvidenceDelivery_index[i+1]]
}
func (i EvidenceDelivery) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
func (i *EvidenceDelivery) UnmarshalText(text []byte) error {
val, err := ParseEvidenceDelivery(string(text))
if err != nil {
return err
}
*i = val
return nil
}
func (i EvidenceDelivery) IsUpload() bool {
return i == Upload
}
func (i EvidenceDelivery) IsPost() bool {
return i == Post
}
func ParseEvidenceDelivery(s string) (EvidenceDelivery, error) {
switch s {
case "upload":
return Upload, nil
case "post":
return Post, nil
default:
return EvidenceDelivery(0), fmt.Errorf("invalid EvidenceDelivery '%s'", s)
}
}
type EvidenceDeliveryOptions struct {
Upload EvidenceDelivery
Post EvidenceDelivery
}
var EvidenceDeliveryValues = EvidenceDeliveryOptions{
Upload: Upload,
Post: Post,
}
func (i EvidenceDelivery) Empty() bool {
return i == EvidenceDelivery(0)
}