aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/profile_enum.go
blob: 514ee14d6656e22f783d5f55af673c4c7d86da9b (plain) (blame)
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
// Code generated by "enumer -type ProfileEventType -trimprefix Profile -output profile_enum.go"; DO NOT EDIT.

package proto

import (
	"fmt"
	"strings"
)

const _ProfileEventTypeName = "IncrementGauge"

var _ProfileEventTypeIndex = [...]uint8{0, 9, 14}

const _ProfileEventTypeLowerName = "incrementgauge"

func (i ProfileEventType) String() string {
	i -= 1
	if i >= ProfileEventType(len(_ProfileEventTypeIndex)-1) {
		return fmt.Sprintf("ProfileEventType(%d)", i+1)
	}
	return _ProfileEventTypeName[_ProfileEventTypeIndex[i]:_ProfileEventTypeIndex[i+1]]
}

// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _ProfileEventTypeNoOp() {
	var x [1]struct{}
	_ = x[ProfileIncrement-(1)]
	_ = x[ProfileGauge-(2)]
}

var _ProfileEventTypeValues = []ProfileEventType{ProfileIncrement, ProfileGauge}

var _ProfileEventTypeNameToValueMap = map[string]ProfileEventType{
	_ProfileEventTypeName[0:9]:       ProfileIncrement,
	_ProfileEventTypeLowerName[0:9]:  ProfileIncrement,
	_ProfileEventTypeName[9:14]:      ProfileGauge,
	_ProfileEventTypeLowerName[9:14]: ProfileGauge,
}

var _ProfileEventTypeNames = []string{
	_ProfileEventTypeName[0:9],
	_ProfileEventTypeName[9:14],
}

// ProfileEventTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ProfileEventTypeString(s string) (ProfileEventType, error) {
	if val, ok := _ProfileEventTypeNameToValueMap[s]; ok {
		return val, nil
	}

	if val, ok := _ProfileEventTypeNameToValueMap[strings.ToLower(s)]; ok {
		return val, nil
	}
	return 0, fmt.Errorf("%s does not belong to ProfileEventType values", s)
}

// ProfileEventTypeValues returns all values of the enum
func ProfileEventTypeValues() []ProfileEventType {
	return _ProfileEventTypeValues
}

// ProfileEventTypeStrings returns a slice of all String values of the enum
func ProfileEventTypeStrings() []string {
	strs := make([]string, len(_ProfileEventTypeNames))
	copy(strs, _ProfileEventTypeNames)
	return strs
}

// IsAProfileEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ProfileEventType) IsAProfileEventType() bool {
	for _, v := range _ProfileEventTypeValues {
		if i == v {
			return true
		}
	}
	return false
}