Versions in this module Expand all Collapse all v1 v1.1.0 Apr 6, 2022 v1.0.0 Mar 23, 2022 Changes in this version + const TomlConfigParserType + const TomlServerConfigParserType + const YamlConfigParserType + const YamlServerConfigParserType + const YmlConfigParserType + const YmlServerConfigParserType + var ErrConfigParserPath = errors.New("config path nil") + var ErrConfigParserTyp = errors.New("config parser error") + var ErrConfigParserType = errors.New("config typ nil") + var ErrFileTypeNil = errors.New("file type nil") + type ApolloConfigParser struct + func (a *ApolloConfigParser) Get(key string) interface{} + func (a *ApolloConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool) + func (a *ApolloConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo + func (a *ApolloConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool) + func (a *ApolloConfigParser) GetRedisConfigs() []RedisConfigInfo + func (a *ApolloConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool) + func (a *ApolloConfigParser) GetRpcConfigs() []RpcNetConfigInfo + func (a *ApolloConfigParser) Unmarshal(obj interface{}) error + func (e *ApolloConfigParser) Reload() error + type Config struct + DatabaseConfigs []DatabaseConfigInfo + RedisConfigs []RedisConfigInfo + RpcNetConfigs []RpcNetConfigInfo + ServiceDiscovery ServiceDiscovery + type ConfigCenterInfo struct + ApolloAddr string + EtcdAddrs []string + FilePath string + FileType string + type ConfigInfo struct + Path string + Typ string + type ConfigParser interface + Get func(key string) interface{} + GetDataBaseConfig func(key string) (DatabaseConfigInfo, bool) + GetDataBaseConfigs func() []DatabaseConfigInfo + GetRedisConfig func(key string) (RedisConfigInfo, bool) + GetRedisConfigs func() []RedisConfigInfo + GetRpcConfig func(key string) (RpcNetConfigInfo, bool) + GetRpcConfigs func() []RpcNetConfigInfo + GetServiceDiscoveryConfig func() (ServiceDiscovery, bool) + Reload func() error + Unmarshal func(obj interface{}) error + func NewApolloConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error) + func NewConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error) + func NewEtcdConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error) + func NewFileConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error) + type DatabaseAccount struct + Ip string + Password string + Username string + type DatabaseConfigInfo struct + Charset string + ConnMaxIdleTime int + ConnMaxLifetime int + Database string + DiscoverFlag bool + Loc string + LogModel bool + Master DatabaseAccount + MaxIdleConns int + MaxOpenConns int + Name string + ParseTime string + ReadTimeout string + Slaves []DatabaseAccount + type EtcdConfigParser struct + func (e *EtcdConfigParser) Get(key string) interface{} + func (e *EtcdConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool) + func (e *EtcdConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo + func (e *EtcdConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool) + func (e *EtcdConfigParser) GetRedisConfigs() []RedisConfigInfo + func (e *EtcdConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool) + func (e *EtcdConfigParser) GetRpcConfigs() []RpcNetConfigInfo + func (e *EtcdConfigParser) Reload() error + func (e *EtcdConfigParser) Unmarshal(obj interface{}) error + type FileConfigParser struct + func (f *FileConfigParser) Get(key string) interface{} + func (f *FileConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool) + func (f *FileConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo + func (f *FileConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool) + func (f *FileConfigParser) GetRedisConfigs() []RedisConfigInfo + func (f *FileConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool) + func (f *FileConfigParser) GetRpcConfigs() []RpcNetConfigInfo + func (f *FileConfigParser) GetServiceDiscoveryConfig() (ServiceDiscovery, bool) + func (f *FileConfigParser) Reload() error + func (f *FileConfigParser) Unmarshal(obj interface{}) error + type LogConfigInfo struct + AutoClearHours int + Depth int + Dir string + Format string + LogLevel string + LogTyp string + Prefix string + type RedisConfigInfo struct + Addr string + ConnectTimeout int64 + Database int + IdleTimeout int64 + MaxActive int + MaxIdle int + Name string + Password string + ReadTimeout int64 + SlowTime int64 + Wait bool + WriteTimeout int64 + type RpcNetConfigInfo struct + Addr []string + Balancetype string + DialTimeout int + EndpointsFrom string + IdleConnTimeout int + MaxConnsPerAddr int + MaxIdleConns int + MaxIdleConnsPerAddr int + Proto string + ReadBufferSize int + RetryTimes int + ServiceName string + TimeOut int + Wight []int + WriteBufferSize int + type ServerConfig struct + ConfigCenter ConfigCenterInfo + LogConfig LogConfigInfo + ServerConfig ServerConfigInfo + type ServerConfigInfo struct + HttpPort string + RpcPort string + ServiceName string + type ServerConfigManager struct + ServerConfig ServerConfig + func (scm *ServerConfigManager) Get(key string) interface{} + func (scm *ServerConfigManager) GetConfigCenterInfo() ConfigCenterInfo + func (scm *ServerConfigManager) GetLogConfigInfo() LogConfigInfo + func (scm *ServerConfigManager) GetServerConfigInfo() ServerConfigInfo + type ServerConfigParser interface + Get func(key string) interface{} + GetConfigCenterInfo func() ConfigCenterInfo + GetLogConfigInfo func() LogConfigInfo + GetServerConfigInfo func() ServerConfigInfo + func NewServerConfigManager(conf ConfigInfo) (ServerConfigParser, error) + func NewServerConfigParser(conf ConfigInfo) (ServerConfigParser, error) + type ServiceDiscovery struct + CustomServiceDiscovery []string + EtcdAddr []string + ZkAddr []string