1 Star 0 Fork 0

SasukeBo/go-micro

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
options.go 675 Bytes
Copy Edit Raw Blame History
汪波 authored 2023-02-23 10:27 +08:00 . fix: 替换包名
package multi
import (
"context"
"gitee.com/sasukebo/go-micro/v4/registry"
)
type writeKey struct{}
type readKey struct{}
// helper for setting registry options
func setRegistryOption(k, v interface{}) registry.Option {
return func(o *registry.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, k, v)
}
}
// WriteRegistry add underlining registries
func WriteRegistry(w ...registry.Registry) registry.Option {
return setRegistryOption(writeKey{}, w)
}
// ReadRegistry add underlining registries
func ReadRegistry(r ...registry.Registry) registry.Option {
return setRegistryOption(readKey{}, r)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sasukebo/go-micro.git
git@gitee.com:sasukebo/go-micro.git
sasukebo
go-micro
go-micro
6e18eb58b836

Search