mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
Module path, package names, and identifiers de-branded to native/proto/compress/ pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used by hanzo-ds/go (proto + compress).
80 lines
2.0 KiB
Go
80 lines
2.0 KiB
Go
// 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
|
|
}
|