go_config_centor

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: MIT Imports: 11 Imported by: 0

README

go_config_centor

基于zookeeper的配置中心

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger added in v1.0.6

func SetLogger(logger log.Logger)

Types

type Center

type Center struct {
	RemotePath string
	// contains filtered or unexported fields
}

func NewCenter

func NewCenter(Path, Name string) (center *Center)

func (*Center) EnablePublicConfig added in v1.0.2

func (c *Center) EnablePublicConfig(b bool)

func (*Center) GetBool

func (c *Center) GetBool(key string) bool

func (*Center) GetDuration

func (c *Center) GetDuration(key string) time.Duration

func (*Center) GetFileConfig added in v1.0.6

func (c *Center) GetFileConfig(fileName string) *FileConfig

func (*Center) GetFloat64

func (c *Center) GetFloat64(key string) float64

func (*Center) GetHBaseThrift added in v1.0.2

func (c *Center) GetHBaseThrift() string

func (*Center) GetHBaseThrift2 added in v1.0.2

func (c *Center) GetHBaseThrift2() string

func (*Center) GetInt

func (c *Center) GetInt(key string) int

func (*Center) GetInt32

func (c *Center) GetInt32(key string) int32

func (*Center) GetInt64

func (c *Center) GetInt64(key string) int64

func (*Center) GetIntSlice

func (c *Center) GetIntSlice(key string) []int

func (*Center) GetKafkaAddresses added in v1.0.2

func (c *Center) GetKafkaAddresses() (addrArr []string, err error)

func (*Center) GetPublicPostgres added in v1.0.3

func (c *Center) GetPublicPostgres() *PostgreSQLConfig

func (*Center) GetPublicRedis added in v1.0.3

func (c *Center) GetPublicRedis() *RedisConfig

func (*Center) GetSizeInBytes

func (c *Center) GetSizeInBytes(key string) uint

func (*Center) GetString

func (c *Center) GetString(key string) string

func (*Center) GetStringMap

func (c *Center) GetStringMap(key string) map[string]interface{}

func (*Center) GetStringMapString

func (c *Center) GetStringMapString(key string) map[string]string

func (*Center) GetStringMapStringSlice

func (c *Center) GetStringMapStringSlice(key string) map[string][]string

func (*Center) GetStringSlice

func (c *Center) GetStringSlice(key string) []string

func (*Center) GetTime

func (c *Center) GetTime(key string) time.Time

func (*Center) GetUint

func (c *Center) GetUint(key string) uint

func (*Center) GetUint32

func (c *Center) GetUint32(key string) uint32

func (*Center) GetUint64

func (c *Center) GetUint64(key string) uint64

func (*Center) Open added in v1.0.2

func (c *Center) Open() (err error)

func (*Center) SetDefault

func (c *Center) SetDefault(key string, value interface{})

func (*Center) SetOnlineMode added in v1.0.2

func (c *Center) SetOnlineMode(b bool)

func (*Center) SetPublicDefault added in v1.0.2

func (c *Center) SetPublicDefault()

func (*Center) Sync

func (c *Center) Sync() (err error)

func (*Center) Update added in v1.0.2

func (c *Center) Update() (err error)

type FileConfig added in v1.0.5

type FileConfig struct {
	*viper.Viper
	// contains filtered or unexported fields
}

func (*FileConfig) Debug added in v1.0.6

func (f *FileConfig) Debug() bool

func (*FileConfig) GetZKHosts added in v1.0.5

func (f *FileConfig) GetZKHosts() []string

func (*FileConfig) Sync added in v1.0.5

func (f *FileConfig) Sync() error

type PostgreSQLConfig added in v1.0.2

type PostgreSQLConfig struct {
	Write SQLConfig
	Read  []SQLConfig
}

type RedisConfig added in v1.0.2

type RedisConfig struct {
	// A seed list of host:port addresses of cluster nodes.
	Addrs []string

	// The maximum number of retries before giving up. Command is retried
	// on network errors and MOVED/ASK redirects.
	// Default is 8 retries.
	MaxRedirects int

	// Enables read-only commands on slave nodes.
	ReadOnly bool
	// Allows routing read-only commands to the closest master or slave node.
	// It automatically enables ReadOnly.
	RouteByLatency bool
	// Allows routing read-only commands to the random master or slave node.
	// It automatically enables ReadOnly.
	RouteRandomly bool

	Password string

	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	// PoolSize applies per cluster node and not for the whole cluster.
	PoolSize           int
	MinIdleConns       int
	MaxConnAge         time.Duration
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}

type SQLConfig added in v1.0.2

type SQLConfig struct {
	Host     string
	Port     int
	User     string
	Password string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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