Documentation ¶
Index ¶
- Constants
- func CheckOrStoreConstCfg(fileDir, fileName string, cfg *ConstConfig) (ok bool, err error)
- func NewIllegalConfigError(configKey string) error
- type Config
- func (c *Config) CheckAndGetBool(key string) (bool, bool)
- func (c *Config) CheckAndGetString(key string) (string, bool)
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetBoolWithDefault(key string, defval bool) bool
- func (c *Config) GetFloat(key string) float64
- func (c *Config) GetInt(key string) int64
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetSlice(key string) []interface{}
- func (c *Config) GetString(key string) string
- func (c *Config) GetStringSlice(key string) []string
- type ConstConfig
Constants ¶
View Source
const (
DefaultConstConfigFile = "constcfg"
)
Variables ¶
This section is empty.
Functions ¶
func CheckOrStoreConstCfg ¶
func CheckOrStoreConstCfg(fileDir, fileName string, cfg *ConstConfig) (ok bool, err error)
check listen port, raft replica port and raft heartbeat port
func NewIllegalConfigError ¶
Types ¶
type Config ¶
type Config struct { Raw []byte // contains filtered or unexported fields }
Config defines the struct of a configuration in general.
func LoadConfigFile ¶
LoadConfigFile loads config information from a JSON file.
func LoadConfigString ¶
LoadConfigString loads config information from a JSON string.
func (*Config) CheckAndGetBool ¶
GetBool returns a bool value for the config key.
func (*Config) CheckAndGetString ¶
Check and get a string for the config key.
func (*Config) GetBoolWithDefault ¶
returns a bool value for the config key with default val when not present
func (*Config) GetStringSlice ¶
type ConstConfig ¶
type ConstConfig struct { Listen string `json:"listen"` RaftReplicaPort string `json:"raftReplicaPort"` RaftHeartbetPort string `json:"raftHeartbetPort"` }
func (*ConstConfig) Equals ¶
func (ccfg *ConstConfig) Equals(cfg *ConstConfig) bool
Click to show internal directories.
Click to hide internal directories.