-
Notifications
You must be signed in to change notification settings - Fork 9
/
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)
}