Documentation
¶
Index ¶
- Variables
- func Close() error
- func Exist(ctx context.Context, key string) (bool, error)
- func InitDefaultClient(ctx context.Context, config *Config) error
- func NewConfigCenterPlugin(_ context.Context) application.Plugin
- func RegistryImplementation(typeName string, fn RegistryImplementationFunc)
- func Set(ctx context.Context, key, value string) error
- func Trans2EtcdConfig(ctx context.Context, config *Config) clientv3.Config
- func Trans2NacosConfig(_ context.Context, config *Config) (clientConfig *constant.ClientConfig, serverConfigs []constant.ServerConfig, ...)
- func Watch(ctx context.Context, item *Item, callback func(item *Item)) error
- type Client
- type Config
- type EtcdConfigClient
- func (s *EtcdConfigClient) Close() error
- func (s *EtcdConfigClient) Exist(ctx context.Context, key string) (bool, error)
- func (s *EtcdConfigClient) Get(ctx context.Context, key string) (*Item, error)
- func (s *EtcdConfigClient) Init(ctx context.Context, conf *Config) error
- func (s *EtcdConfigClient) Set(ctx context.Context, key, value string) error
- func (s *EtcdConfigClient) Watch(ctx context.Context, item *Item, callback func(item *Item)) error
- type Item
- type NacosConfigClient
- func (s *NacosConfigClient) Close() error
- func (s *NacosConfigClient) Exist(ctx context.Context, key string) (bool, error)
- func (s *NacosConfigClient) Get(ctx context.Context, key string) (*Item, error)
- func (s *NacosConfigClient) Init(ctx context.Context, conf *Config) error
- func (s *NacosConfigClient) Set(_ context.Context, key, value string) error
- func (s *NacosConfigClient) Watch(ctx context.Context, item *Item, callback func(item *Item)) error
- type Plugin
- type RegistryImplementationFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EtcdDefaultDailTimeout = time.Second EtcdDefaultDialKeepAliveTime = 3 * time.Second EtcdDefaultDialKeepAliveTimeout = 3 * time.Second )
View Source
var RegistryImplementationTypeNameEtcd = "etcd"
View Source
var RegistryImplementationTypeNameNacos = "nacos"
Functions ¶
func InitDefaultClient ¶ added in v0.2.0
func NewConfigCenterPlugin ¶ added in v0.2.0
func NewConfigCenterPlugin(_ context.Context) application.Plugin
NewConfigCenterPlugin 配置中心组件
func RegistryImplementation ¶ added in v0.2.0
func RegistryImplementation(typeName string, fn RegistryImplementationFunc)
func Trans2EtcdConfig ¶ added in v0.2.0
func Trans2NacosConfig ¶ added in v0.2.0
func Trans2NacosConfig(_ context.Context, config *Config) (clientConfig *constant.ClientConfig, serverConfigs []constant.ServerConfig, err error)
Types ¶
type Client ¶ added in v0.2.0
type Client interface { Close() error Init(ctx context.Context, config *Config) error Set(ctx context.Context, key, value string) error Get(ctx context.Context, key string) (*Item, error) Watch(ctx context.Context, item *Item, callback func(item *Item)) error Exist(ctx context.Context, key string) (bool, error) }
type Config ¶ added in v0.2.0
type Config struct { Type string `yaml:"type" json:"type"` Endpoints string `yaml:"endpoints" json:"endpoints"` Namespace string `yaml:"namespace" json:"namespace"` Username string `yaml:"username" json:"userName"` Password string `yaml:"password" json:"password"` Settings map[string]string `yaml:"settings" json:"settings"` }
type EtcdConfigClient ¶ added in v0.2.0
type EtcdConfigClient struct {
// contains filtered or unexported fields
}
func (*EtcdConfigClient) Close ¶ added in v0.2.0
func (s *EtcdConfigClient) Close() error
func (*EtcdConfigClient) Init ¶ added in v0.2.0
func (s *EtcdConfigClient) Init(ctx context.Context, conf *Config) error
type Item ¶ added in v0.2.0
type NacosConfigClient ¶ added in v0.2.0
type NacosConfigClient struct {
// contains filtered or unexported fields
}
func (*NacosConfigClient) Close ¶ added in v0.2.0
func (s *NacosConfigClient) Close() error
func (*NacosConfigClient) Init ¶ added in v0.2.0
func (s *NacosConfigClient) Init(ctx context.Context, conf *Config) error
type Plugin ¶ added in v0.2.0
type Plugin struct { application.Plugin // contains filtered or unexported fields }
type RegistryImplementationFunc ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.