cConfig

package module
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConf

func GetConf(name string) (interface{}, error)

func Inject

func Inject(instance interface{})

func IsConf

func IsConf(instance interface{}) bool

func ListenConf

func ListenConf(names []string, handler HandleFunc)

func Load

func Load()

Types

type ConfigCenterClientInterface added in v0.0.9

type ConfigCenterClientInterface interface {
	InitClient() (err error)
	ReadConf(name string)
	ListenConf(name string)
}

type ConfigCenterConf

type ConfigCenterConf struct {
	Enable   bool                       `json:"enable"`
	Backup   bool                       `json:"backup"`
	Driver   string                     `json:"driver"`
	Interval int64                      `json:"interval"`
	Clients  *ConfigCenterConf_Clients  `json:"clients"`
	Listens  []*ConfigCenterConf_Listen `json:"listens"`
}

func (*ConfigCenterConf) ConfigName

func (i *ConfigCenterConf) ConfigName() string

type ConfigCenterConf_Clients added in v0.0.9

type ConfigCenterConf_Clients struct {
	File  *ConfigCenterConf_FileClient  `json:"file"`
	Redis *ConfigCenterConf_RedisClient `json:"redis"`
	Nacos *ConfigCenterConf_NacosClient `json:"nacos"`
}

type ConfigCenterConf_FileClient added in v0.0.9

type ConfigCenterConf_FileClient struct {
	Path string `json:"path"`
}

type ConfigCenterConf_Listen added in v0.0.9

type ConfigCenterConf_Listen struct {
	Group string `json:"group"`
	Data  string `json:"data"`
	Conf  string `json:"conf"`
}

type ConfigCenterConf_NacosClient added in v0.0.9

type ConfigCenterConf_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"`
}

type ConfigCenterConf_RedisClient added in v0.0.9

type ConfigCenterConf_RedisClient struct{}

type ConfigContainer

type ConfigContainer struct {
	Enable        bool
	Backup        bool
	Interval      int64
	Driver        string
	Clients       *ConfigContainer_Clients
	Listens       []string
	ListenData    map[string]string
	ListenGroup   map[string]string
	ListenVersion map[string]string
	Instances     map[string]interface{}
	Handlers      map[string][]HandleFunc
	Timers        map[string]*time.Ticker
}

type ConfigContainer_Clients added in v0.0.9

type ConfigContainer_Clients struct {
	File  string
	Redis *redis.Client
	Nacos config_client.IConfigClient
}

type ConfigInterface

type ConfigInterface interface {
	ConfigName() string
}

type FileClient added in v0.0.9

type FileClient struct{}

func (*FileClient) InitClient added in v0.0.9

func (i *FileClient) InitClient() (err error)

func (*FileClient) ListenConf added in v0.0.9

func (i *FileClient) ListenConf(name string)

func (*FileClient) ReadConf added in v0.0.9

func (i *FileClient) ReadConf(name string)

type HandleFunc

type HandleFunc func()

type NacosClient added in v0.0.9

type NacosClient struct{}

func (*NacosClient) InitClient added in v0.0.9

func (i *NacosClient) InitClient() error

func (*NacosClient) ListenConf added in v0.0.9

func (i *NacosClient) ListenConf(name string)

func (*NacosClient) ReadConf added in v0.0.9

func (i *NacosClient) ReadConf(name string)

Jump to

Keyboard shortcuts

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