nacos

package
v2.1.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogDebug = "debug"
	LogWarn  = "warn"
	LogError = "error"
	LogInfo  = "info"
)

Variables

This section is empty.

Functions

func CallBackFunc

func CallBackFunc(group, dataId string, callback func(namespace, group, dataId, data string)) error

CallBackFunc 参数更新回调方法

func GetConfig

func GetConfig(group string, dataIds string) string

GetConfig 获取单条配置

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 SetLocalConfig added in v2.0.2

func SetLocalConfig(configs string)

SetLocalConfig 注入本地配置

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 GetViper added in v2.0.2

func GetViper() *ViperToml

GetViper 获取VT实例

func (*ViperToml) GetConfig

func (vt *ViperToml) GetConfig() (string, error)

GetConfig 获取整套配置文件

func (*ViperToml) GetConfigParse added in v2.0.2

func (vt *ViperToml) GetConfigParse(confPtr interface{}) error

GetConfigParse 获取配置并且绑定结构体

func (*ViperToml) NacosToViper

func (vt *ViperToml) NacosToViper()

NacosToViper 同步Nacos读取的配置注入Viper

func (*ViperToml) SetBaseConfig added in v2.0.2

func (vt *ViperToml) SetBaseConfig(configs string)

SetBaseConfig 注入基础配置

func (*ViperToml) SetCallBackFunc

func (vt *ViperToml) SetCallBackFunc(group, dataId string, callback func(namespace, group, dataId, data string))

SetCallBackFunc 配置自定义回调方法

func (*ViperToml) SetDataIds

func (vt *ViperToml) SetDataIds(group string, dataIds ...string)

SetDataIds 设置需要读取哪些配置 配置默认回调方法更新配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL