-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtypes_enum.go
75 lines (63 loc) · 1.93 KB
/
types_enum.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
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package sink
import (
"fmt"
"strings"
)
const (
// SubstreamsModeDevelopment is a SubstreamsMode of type Development.
SubstreamsModeDevelopment SubstreamsMode = iota
// SubstreamsModeProduction is a SubstreamsMode of type Production.
SubstreamsModeProduction
)
const _SubstreamsModeName = "DevelopmentProduction"
var _SubstreamsModeNames = []string{
_SubstreamsModeName[0:11],
_SubstreamsModeName[11:21],
}
// SubstreamsModeNames returns a list of possible string values of SubstreamsMode.
func SubstreamsModeNames() []string {
tmp := make([]string, len(_SubstreamsModeNames))
copy(tmp, _SubstreamsModeNames)
return tmp
}
var _SubstreamsModeMap = map[SubstreamsMode]string{
SubstreamsModeDevelopment: _SubstreamsModeName[0:11],
SubstreamsModeProduction: _SubstreamsModeName[11:21],
}
// String implements the Stringer interface.
func (x SubstreamsMode) String() string {
if str, ok := _SubstreamsModeMap[x]; ok {
return str
}
return fmt.Sprintf("SubstreamsMode(%d)", x)
}
var _SubstreamsModeValue = map[string]SubstreamsMode{
_SubstreamsModeName[0:11]: SubstreamsModeDevelopment,
_SubstreamsModeName[11:21]: SubstreamsModeProduction,
}
// ParseSubstreamsMode attempts to convert a string to a SubstreamsMode
func ParseSubstreamsMode(name string) (SubstreamsMode, error) {
if x, ok := _SubstreamsModeValue[name]; ok {
return x, nil
}
return SubstreamsMode(0), fmt.Errorf("%s is not a valid SubstreamsMode, try [%s]", name, strings.Join(_SubstreamsModeNames, ", "))
}
// MarshalText implements the text marshaller method
func (x SubstreamsMode) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
// UnmarshalText implements the text unmarshaller method
func (x *SubstreamsMode) UnmarshalText(text []byte) error {
name := string(text)
tmp, err := ParseSubstreamsMode(name)
if err != nil {
return err
}
*x = tmp
return nil
}