2 Star 1 Fork 2

trackertrader / rpcx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
selectmode_enumer.go 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
kevinyang 提交于 2021-07-05 10:32 . add
// Code generated by "enumer -type=SelectMode"; DO NOT EDIT.
package client
import (
"fmt"
)
const _SelectModeName = "RandomSelectRoundRobinWeightedRoundRobinWeightedICMPConsistentHashClosest"
var _SelectModeIndex = [...]uint8{0, 12, 22, 40, 52, 66, 73}
func (i SelectMode) String() string {
if i < 0 || i >= SelectMode(len(_SelectModeIndex)-1) {
return fmt.Sprintf("SelectMode(%d)", i)
}
return _SelectModeName[_SelectModeIndex[i]:_SelectModeIndex[i+1]]
}
var _SelectModeValues = []SelectMode{0, 1, 2, 3, 4, 5}
var _SelectModeNameToValueMap = map[string]SelectMode{
_SelectModeName[0:12]: 0,
_SelectModeName[12:22]: 1,
_SelectModeName[22:40]: 2,
_SelectModeName[40:52]: 3,
_SelectModeName[52:66]: 4,
_SelectModeName[66:73]: 5,
}
// SelectModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func SelectModeString(s string) (SelectMode, error) {
if val, ok := _SelectModeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to SelectMode values", s)
}
// SelectModeValues returns all values of the enum
func SelectModeValues() []SelectMode {
return _SelectModeValues
}
// IsASelectMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i SelectMode) IsASelectMode() bool {
for _, v := range _SelectModeValues {
if i == v {
return true
}
}
return false
}
Go
1
https://gitee.com/trackertrader/rpcx.git
git@gitee.com:trackertrader/rpcx.git
trackertrader
rpcx
rpcx
v1.1.6

搜索帮助