Documentation ¶
Index ¶
- Constants
- Variables
- func GetConf(name string) (any, error)
- func ReadEnv(id, group string, explain bool) (result string, err error)
- func ReplaceSlice(s, old, new string) string
- type ClientInterface
- type ConfigCenterConf
- type ConfigCenterConf_Clients
- type ConfigCenterConf_ListenItem
- type ConfigCenterDriver
- type ConfigComponent
- type ConfigContainer
- func (i *ConfigContainer) CompareVersion(name, version string) bool
- func (i *ConfigContainer) Get(name string) any
- func (i *ConfigContainer) GetConfigListeners(name string) []cComponents.ListenHandler
- func (i *ConfigContainer) Is(instance any) bool
- func (i *ConfigContainer) IsConfigListener(instance any) bool
- func (i *ConfigContainer) Range(f func(instance any))
- func (i *ConfigContainer) Remove(name string) bool
- func (i *ConfigContainer) Save(instance any) bool
- func (i *ConfigContainer) SaveConfigListener(listener *cComponents.ConfigListener) bool
- func (i *ConfigContainer) SaveVersion(name, version string)
- type DecoderInterface
- type ExplainItem
- type FileClient
- type NacosClient
- type ReadFunc
- type ReplaceFunc
- type ZipClient
Constants ¶
View Source
const ( ExplainRegexpText = `\$text\{([\w_\-\/]+)(\.?([\w_\-]+))?\}` // 字符串替换字符串 ExplainRegexpJson = `\"\$json\{([\w_\-\/]+)(\.?([\w_\-]+))?\}\"` // 字符串替换对象 ExplainRegexpArray = `\"\$(array|jsonArray|slice)\{([\w_\-\/]+)(\.?([\w_\-]+))?\}\"` // 数组添加元素 ExplainRegexpEnv = `\"\$env\{([\w_]+)(\.(string|int|bool|number))\}\"` // 数组添加元素 )
Variables ¶
View Source
var AllExplainRegexp = map[string]ReplaceFunc{ ExplainRegexpText: strings.ReplaceAll, ExplainRegexpJson: strings.ReplaceAll, ExplainRegexpArray: ReplaceSlice, ExplainRegexpEnv: strings.ReplaceAll, }
View Source
var Component = &ConfigComponent{}
Functions ¶
func ReplaceSlice ¶ added in v0.4.0
Types ¶
type ClientInterface ¶ added in v0.4.0
type ConfigCenterConf ¶
type ConfigCenterConf struct { Enable bool `json:"enable"` Backup bool `json:"backup"` Driver ConfigCenterDriver `json:"driver"` Interval int64 `json:"interval"` Layers int64 `json:"layers"` Clients *ConfigCenterConf_Clients `json:"clients"` Listens []*ConfigCenterConf_ListenItem `json:"listens"` }
func (*ConfigCenterConf) ConfigName ¶
func (i *ConfigCenterConf) ConfigName() string
type ConfigCenterConf_Clients ¶ added in v0.0.9
type ConfigCenterConf_Clients struct { File *FileClient `json:"file"` Zip *ZipClient `json:"zip"` Nacos *NacosClient `json:"nacos"` Customize ClientInterface `json:"-"` }
type ConfigCenterConf_ListenItem ¶ added in v0.4.0
type ConfigCenterConf_ListenItem struct { Group string `json:"group"` Data string `json:"data"` Conf string `json:"conf"` Driver ConfigCenterDriver `json:"driver"` }
type ConfigCenterDriver ¶ added in v0.4.0
type ConfigCenterDriver string
const ( ConfigCenterConfigName = "ConfigCenterConf" FileDriver ConfigCenterDriver = "file" ZipDriver ConfigCenterDriver = "zip" NacosDriver ConfigCenterDriver = "nacos" CustomizeDriver ConfigCenterDriver = "customize" )
type ConfigComponent ¶ added in v0.3.2
type ConfigComponent struct{}
func (*ConfigComponent) Inject ¶ added in v0.3.2
func (i *ConfigComponent) Inject(instance any) bool
func (*ConfigComponent) InjectConf ¶ added in v0.4.0
func (i *ConfigComponent) InjectConf(config cComponents.ConfigInterface) bool
func (*ConfigComponent) Listen ¶ added in v0.4.0
func (i *ConfigComponent) Listen() []*cComponents.ConfigListener
func (*ConfigComponent) Load ¶ added in v0.3.2
func (i *ConfigComponent) Load()
type ConfigContainer ¶
type ConfigContainer struct {
// contains filtered or unexported fields
}
func (*ConfigContainer) CompareVersion ¶ added in v0.4.0
func (i *ConfigContainer) CompareVersion(name, version string) bool
func (*ConfigContainer) Get ¶ added in v0.4.0
func (i *ConfigContainer) Get(name string) any
func (*ConfigContainer) GetConfigListeners ¶ added in v0.4.0
func (i *ConfigContainer) GetConfigListeners(name string) []cComponents.ListenHandler
func (*ConfigContainer) Is ¶ added in v0.4.0
func (i *ConfigContainer) Is(instance any) bool
func (*ConfigContainer) IsConfigListener ¶ added in v0.4.0
func (i *ConfigContainer) IsConfigListener(instance any) bool
func (*ConfigContainer) Range ¶ added in v0.4.0
func (i *ConfigContainer) Range(f func(instance any))
func (*ConfigContainer) Remove ¶ added in v0.4.0
func (i *ConfigContainer) Remove(name string) bool
func (*ConfigContainer) Save ¶ added in v0.4.0
func (i *ConfigContainer) Save(instance any) bool
func (*ConfigContainer) SaveConfigListener ¶ added in v0.4.0
func (i *ConfigContainer) SaveConfigListener(listener *cComponents.ConfigListener) bool
func (*ConfigContainer) SaveVersion ¶ added in v0.4.0
func (i *ConfigContainer) SaveVersion(name, version string)
type DecoderInterface ¶ added in v0.4.2
type ExplainItem ¶ added in v0.4.13
type ExplainItem struct { Reg string `json:"reg"` Source string `json:"source"` Target string `json:"target"` DataID string `json:"data_id"` GroupID string `json:"group_id"` ReplaceFunc ReplaceFunc `json:"-"` ReadFunc ReadFunc `json:"-"` }
func Explain ¶ added in v0.4.0
func Explain(client ClientInterface, content string) (result []*ExplainItem, err error)
type FileClient ¶ added in v0.0.9
func (*FileClient) Driver ¶ added in v0.4.0
func (i *FileClient) Driver() ConfigCenterDriver
func (*FileClient) InitClient ¶ added in v0.0.9
func (i *FileClient) InitClient() error
type NacosClient ¶ added in v0.0.9
type NacosClient struct { Scheme string `json:"scheme"` Host string `json:"host"` Port uint64 `json:"port"` Username string `json:"username"` Password string `json:"password"` Namespace string `json:"namespace"` Path string `json:"path"` // contains filtered or unexported fields }
func (*NacosClient) Driver ¶ added in v0.4.0
func (i *NacosClient) Driver() ConfigCenterDriver
func (*NacosClient) InitClient ¶ added in v0.0.9
func (i *NacosClient) InitClient() error
type ReplaceFunc ¶ added in v0.4.0
type ZipClient ¶ added in v0.4.5
type ZipClient struct { Namespace string `json:"namespace"` Path string `json:"path"` Password string `json:"password"` }
func (*ZipClient) Driver ¶ added in v0.4.5
func (i *ZipClient) Driver() ConfigCenterDriver
func (*ZipClient) InitClient ¶ added in v0.4.5
Click to show internal directories.
Click to hide internal directories.