-
Notifications
You must be signed in to change notification settings - Fork 11
/
event_enum.go
55 lines (47 loc) · 1.38 KB
/
event_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
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package cache
import (
"fmt"
"strings"
)
const (
// EventTypeNone is a eventType of type None.
// Not registered Event by default.
EventTypeNone eventType = iota
// EventTypeEvict is a eventType of type Evict.
// Evict presents eviction event.
EventTypeEvict
)
const _eventTypeName = "NoneEvict"
var _eventTypeMap = map[eventType]string{
EventTypeNone: _eventTypeName[0:4],
EventTypeEvict: _eventTypeName[4:9],
}
// String implements the Stringer interface.
func (x eventType) String() string {
if str, ok := _eventTypeMap[x]; ok {
return str
}
return fmt.Sprintf("eventType(%d)", x)
}
var _eventTypeValue = map[string]eventType{
_eventTypeName[0:4]: EventTypeNone,
strings.ToLower(_eventTypeName[0:4]): EventTypeNone,
_eventTypeName[4:9]: EventTypeEvict,
strings.ToLower(_eventTypeName[4:9]): EventTypeEvict,
}
// ParseeventType attempts to convert a string to a eventType.
func ParseeventType(name string) (eventType, error) {
if x, ok := _eventTypeValue[name]; ok {
return x, nil
}
// Case insensitive parse, do a separate lookup to prevent unnecessary cost of lowercasing a string if we don't need to.
if x, ok := _eventTypeValue[strings.ToLower(name)]; ok {
return x, nil
}
return eventType(0), fmt.Errorf("%s is not a valid eventType", name)
}