Documentation ¶
Index ¶
- Constants
- func CallBackFunc(group, dataId string, callback func(namespace, group, dataId, data string)) error
- func GetConfig(group string, dataIds string) string
- func NewLocalNacos(configs string) config_client.IConfigClient
- func NewNacos(ccConfig *constant.ClientConfig, scConfigs ...constant.ServerConfig) error
- func NewNacosEnv()
- func SetLocalConfig(configs string)
- func SetLocalConfigFile(filePath string)
- type LocalNacos
- type ViperToml
- func (vt *ViperToml) GetConfig() (string, error)
- func (vt *ViperToml) GetConfigParse(confPtr interface{}) error
- func (vt *ViperToml) NacosToViper()
- func (vt *ViperToml) SetBaseConfig(configs string)
- func (vt *ViperToml) SetCallBackFunc(group, dataId string, callback func(namespace, group, dataId, data string))
- func (vt *ViperToml) SetDataIds(group string, dataIds ...string)
Constants ¶
View Source
const ( LogDebug = "debug" LogWarn = "warn" LogError = "error" LogInfo = "info" )
Variables ¶
This section is empty.
Functions ¶
func CallBackFunc ¶
CallBackFunc 参数更新回调方法
func NewLocalNacos ¶
func NewLocalNacos(configs string) config_client.IConfigClient
func NewNacos ¶ added in v2.0.2
func NewNacos(ccConfig *constant.ClientConfig, scConfigs ...constant.ServerConfig) error
NewNacos 注入Nacos配置文件
func NewNacosEnv ¶ added in v2.0.9
func NewNacosEnv()
NewNacosEnv 注入Nacos配置文件 兼容endpoint 和 service 两种方式
func SetLocalConfigFile ¶ added in v2.0.2
func SetLocalConfigFile(filePath string)
SetLocalConfigFile 注入本地配置 指定目录
Types ¶
type LocalNacos ¶
type LocalNacos struct { config_client.IConfigClient // contains filtered or unexported fields }
func (*LocalNacos) DeleteConfig ¶
func (l *LocalNacos) DeleteConfig(param vo.ConfigParam) (bool, error)
func (*LocalNacos) GetConfig ¶
func (l *LocalNacos) GetConfig(param vo.ConfigParam) (string, error)
func (*LocalNacos) ListenConfig ¶
func (l *LocalNacos) ListenConfig(params vo.ConfigParam) (err error)
func (*LocalNacos) PublishConfig ¶
func (l *LocalNacos) PublishConfig(param vo.ConfigParam) (bool, error)
type ViperToml ¶
type ViperToml struct {
// contains filtered or unexported fields
}
func (*ViperToml) GetConfigParse ¶ added in v2.0.2
GetConfigParse 获取配置并且绑定结构体
func (*ViperToml) NacosToViper ¶
func (vt *ViperToml) NacosToViper()
NacosToViper 同步Nacos读取的配置注入Viper
func (*ViperToml) SetBaseConfig ¶ added in v2.0.2
SetBaseConfig 注入基础配置
func (*ViperToml) SetCallBackFunc ¶
func (vt *ViperToml) SetCallBackFunc(group, dataId string, callback func(namespace, group, dataId, data string))
SetCallBackFunc 配置自定义回调方法
func (*ViperToml) SetDataIds ¶
SetDataIds 设置需要读取哪些配置 配置默认回调方法更新配置
Click to show internal directories.
Click to hide internal directories.