aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/client_info_interface_enum.go
blob: 3e09b0d52b5de1049757f35b0662aa8bc6b585e1 (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 Interface -trimprefix Interface -output client_info_interface_enum.go"; DO NOT EDIT.

package proto

import (
	"fmt"
	"strings"
)

const _InterfaceName = "TCPHTTP"

var _InterfaceIndex = [...]uint8{0, 3, 7}

const _InterfaceLowerName = "tcphttp"

func (i Interface) String() string {
	i -= 1
	if i >= Interface(len(_InterfaceIndex)-1) {
		return fmt.Sprintf("Interface(%d)", i+1)
	}
	return _InterfaceName[_InterfaceIndex[i]:_InterfaceIndex[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 _InterfaceNoOp() {
	var x [1]struct{}
	_ = x[InterfaceTCP-(1)]
	_ = x[InterfaceHTTP-(2)]
}

var _InterfaceValues = []Interface{InterfaceTCP, InterfaceHTTP}

var _InterfaceNameToValueMap = map[string]Interface{
	_InterfaceName[0:3]:      InterfaceTCP,
	_InterfaceLowerName[0:3]: InterfaceTCP,
	_InterfaceName[3:7]:      InterfaceHTTP,
	_InterfaceLowerName[3:7]: InterfaceHTTP,
}

var _InterfaceNames = []string{
	_InterfaceName[0:3],
	_InterfaceName[3:7],
}

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

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

// InterfaceValues returns all values of the enum
func InterfaceValues() []Interface {
	return _InterfaceValues
}

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

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