aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/client_code_enum.go
blob: 85ffab26bdb1a7b85bc5a1c2b549dadfba781870 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Code generated by "enumer -type ClientCode -trimprefix ClientCode -output client_code_enum.go"; DO NOT EDIT.

package proto

import (
	"fmt"
	"strings"
)

const _ClientCodeName = "HelloQueryDataCancelPingClientTablesStatusRequest"

var _ClientCodeIndex = [...]uint8{0, 5, 10, 14, 20, 24, 49}

const _ClientCodeLowerName = "helloquerydatacancelpingclienttablesstatusrequest"

func (i ClientCode) String() string {
	if i >= ClientCode(len(_ClientCodeIndex)-1) {
		return fmt.Sprintf("ClientCode(%d)", i)
	}
	return _ClientCodeName[_ClientCodeIndex[i]:_ClientCodeIndex[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 _ClientCodeNoOp() {
	var x [1]struct{}
	_ = x[ClientCodeHello-(0)]
	_ = x[ClientCodeQuery-(1)]
	_ = x[ClientCodeData-(2)]
	_ = x[ClientCodeCancel-(3)]
	_ = x[ClientCodePing-(4)]
	_ = x[ClientTablesStatusRequest-(5)]
}

var _ClientCodeValues = []ClientCode{ClientCodeHello, ClientCodeQuery, ClientCodeData, ClientCodeCancel, ClientCodePing, ClientTablesStatusRequest}

var _ClientCodeNameToValueMap = map[string]ClientCode{
	_ClientCodeName[0:5]:        ClientCodeHello,
	_ClientCodeLowerName[0:5]:   ClientCodeHello,
	_ClientCodeName[5:10]:       ClientCodeQuery,
	_ClientCodeLowerName[5:10]:  ClientCodeQuery,
	_ClientCodeName[10:14]:      ClientCodeData,
	_ClientCodeLowerName[10:14]: ClientCodeData,
	_ClientCodeName[14:20]:      ClientCodeCancel,
	_ClientCodeLowerName[14:20]: ClientCodeCancel,
	_ClientCodeName[20:24]:      ClientCodePing,
	_ClientCodeLowerName[20:24]: ClientCodePing,
	_ClientCodeName[24:49]:      ClientTablesStatusRequest,
	_ClientCodeLowerName[24:49]: ClientTablesStatusRequest,
}

var _ClientCodeNames = []string{
	_ClientCodeName[0:5],
	_ClientCodeName[5:10],
	_ClientCodeName[10:14],
	_ClientCodeName[14:20],
	_ClientCodeName[20:24],
	_ClientCodeName[24:49],
}

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

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

// ClientCodeValues returns all values of the enum
func ClientCodeValues() []ClientCode {
	return _ClientCodeValues
}

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

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