-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathzodiac_enum.go
More file actions
106 lines (96 loc) · 2.71 KB
/
Copy pathzodiac_enum.go
File metadata and controls
106 lines (96 loc) · 2.71 KB
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
// Code generated by go-enum DO NOT EDIT.
// Version: 0.3.10
// Revision: 07a5b318d9ef317345f0cfca0c9347eda0e2bfc4
// Build Date: 2022-01-23T20:31:33Z
// Built By: goreleaser
package chronos
import (
"fmt"
)
const (
// ZodiacRat is a Zodiac of type Rat.
ZodiacRat Zodiac = iota
// ZodiacCow is a Zodiac of type Cow.
ZodiacCow
// ZodiacTiger is a Zodiac of type Tiger.
ZodiacTiger
// ZodiacRabbit is a Zodiac of type Rabbit.
ZodiacRabbit
// ZodiacDragon is a Zodiac of type Dragon.
ZodiacDragon
// ZodiacSnake is a Zodiac of type Snake.
ZodiacSnake
// ZodiacHorse is a Zodiac of type Horse.
ZodiacHorse
// ZodiacSheep is a Zodiac of type Sheep.
ZodiacSheep
// ZodiacMonkey is a Zodiac of type Monkey.
ZodiacMonkey
// ZodiacChicken is a Zodiac of type Chicken.
ZodiacChicken
// ZodiacDog is a Zodiac of type Dog.
ZodiacDog
// ZodiacPig is a Zodiac of type Pig.
ZodiacPig
// ZodiacMax is a Zodiac of type Max.
ZodiacMax
)
const _ZodiacName = "RatCowTigerRabbitDragonSnakeHorseSheepMonkeyChickenDogPigMax"
var _ZodiacMap = map[Zodiac]string{
ZodiacRat: _ZodiacName[0:3],
ZodiacCow: _ZodiacName[3:6],
ZodiacTiger: _ZodiacName[6:11],
ZodiacRabbit: _ZodiacName[11:17],
ZodiacDragon: _ZodiacName[17:23],
ZodiacSnake: _ZodiacName[23:28],
ZodiacHorse: _ZodiacName[28:33],
ZodiacSheep: _ZodiacName[33:38],
ZodiacMonkey: _ZodiacName[38:44],
ZodiacChicken: _ZodiacName[44:51],
ZodiacDog: _ZodiacName[51:54],
ZodiacPig: _ZodiacName[54:57],
ZodiacMax: _ZodiacName[57:60],
}
// String implements the Stringer interface.
func (x Zodiac) String() string {
if str, ok := _ZodiacMap[x]; ok {
return str
}
return fmt.Sprintf("Zodiac(%d)", x)
}
var _ZodiacValue = map[string]Zodiac{
_ZodiacName[0:3]: ZodiacRat,
_ZodiacName[3:6]: ZodiacCow,
_ZodiacName[6:11]: ZodiacTiger,
_ZodiacName[11:17]: ZodiacRabbit,
_ZodiacName[17:23]: ZodiacDragon,
_ZodiacName[23:28]: ZodiacSnake,
_ZodiacName[28:33]: ZodiacHorse,
_ZodiacName[33:38]: ZodiacSheep,
_ZodiacName[38:44]: ZodiacMonkey,
_ZodiacName[44:51]: ZodiacChicken,
_ZodiacName[51:54]: ZodiacDog,
_ZodiacName[54:57]: ZodiacPig,
_ZodiacName[57:60]: ZodiacMax,
}
// ParseZodiac attempts to convert a string to a Zodiac.
func ParseZodiac(name string) (Zodiac, error) {
if x, ok := _ZodiacValue[name]; ok {
return x, nil
}
return Zodiac(0), fmt.Errorf("%s is not a valid Zodiac", name)
}
// MarshalText implements the text marshaller method.
func (x Zodiac) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
// UnmarshalText implements the text unmarshaller method.
func (x *Zodiac) UnmarshalText(text []byte) error {
name := string(text)
tmp, err := ParseZodiac(name)
if err != nil {
return err
}
*x = tmp
return nil
}