Fetch the repository succeeded.
package nacos
import (
"context"
"gitee.com/sasukebo/go-micro/v4/config/source"
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
)
type addressKey struct{}
type configKey struct{}
type groupKey struct{}
type dataIdKey struct{}
type encoderKey struct{}
// WithAddress sets the nacos address
func WithAddress(addrs []string) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, addressKey{}, addrs)
}
}
// WithClientConfig sets the nacos config
func WithClientConfig(cc constant.ClientConfig) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, configKey{}, cc)
}
}
// WithGroup sets nacos config group
func WithGroup(g string) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, groupKey{}, g)
}
}
// WithDataId sets nacos config dataId
func WithDataId(id string) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, dataIdKey{}, id)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。