-
Notifications
You must be signed in to change notification settings - Fork 57
/
force_lower_enum.go
59 lines (48 loc) · 1.5 KB
/
force_lower_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
// Code generated by go-enum DO NOT EDIT.
// Version: example
// Revision: example
// Build Date: example
// Built By: example
//go:build example
// +build example
package example
import (
"errors"
"fmt"
)
const (
// ForceLowerTypeDataSwap is a ForceLowerType of type DataSwap.
ForceLowerTypeDataSwap ForceLowerType = iota
// ForceLowerTypeBootNode is a ForceLowerType of type BootNode.
ForceLowerTypeBootNode
)
var ErrInvalidForceLowerType = errors.New("not a valid ForceLowerType")
const _ForceLowerTypeName = "dataswapbootnode"
var _ForceLowerTypeMap = map[ForceLowerType]string{
ForceLowerTypeDataSwap: _ForceLowerTypeName[0:8],
ForceLowerTypeBootNode: _ForceLowerTypeName[8:16],
}
// String implements the Stringer interface.
func (x ForceLowerType) String() string {
if str, ok := _ForceLowerTypeMap[x]; ok {
return str
}
return fmt.Sprintf("ForceLowerType(%d)", x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x ForceLowerType) IsValid() bool {
_, ok := _ForceLowerTypeMap[x]
return ok
}
var _ForceLowerTypeValue = map[string]ForceLowerType{
_ForceLowerTypeName[0:8]: ForceLowerTypeDataSwap,
_ForceLowerTypeName[8:16]: ForceLowerTypeBootNode,
}
// ParseForceLowerType attempts to convert a string to a ForceLowerType.
func ParseForceLowerType(name string) (ForceLowerType, error) {
if x, ok := _ForceLowerTypeValue[name]; ok {
return x, nil
}
return ForceLowerType(0), fmt.Errorf("%s is %w", name, ErrInvalidForceLowerType)
}