1 Star 0 Fork 0

jmesyan/impetus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
options.go 939 Bytes
一键复制 编辑 原始数据 按行查看 历史
jmesyan 提交于 2020-12-12 22:03 . init
package rpcClientService
type Option func(*Options)
type Options struct {
RegistryType string
RegistryAddr string
BasePath string
SelectMode string
}
func newOptions(opts ...Option) *Options {
opt := &Options{
}
for _,o := range opts {
o(opt)
}
return opt
}
// Register service type. option is consul, etcd, etcdv3, zookeeper.
func RegistryType(s string) Option {
return func(options *Options) {
options.RegistryType = s
}
}
// Address of register service
func RegistryAddr(s string) Option {
return func(options *Options) {
options.RegistryAddr = s
}
}
// Base path of service
func BasePath(s string) Option {
return func(options *Options) {
options.BasePath = s
}
}
// Select mode of service. options is "RandomSelect","RoundRobin","WeightedRoundRobin",
// "WeightedICMP","ConsistentHash","Closest".
func SelectMode(s string) Option {
return func(options *Options) {
options.SelectMode = s
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/jmesyan/impetus.git
git@gitee.com:jmesyan/impetus.git
jmesyan
impetus
impetus
v1.0.4

搜索帮助