Documentation ¶
Index ¶
- Constants
- func BooleanToString(val bool) string
- func ByteToString(val byte) string
- func FindChildKeys(basePath string, keys []string) []string
- func Float32ToString(val float32) string
- func Float64ToString(val float64) string
- func GetArrayIndex(idx int) string
- func GetArrayIndexPath(path string, idx int) string
- func GetParentPath(path string) string
- func GetPaths(key string) []string
- func GetSectionKey(path string) string
- func HasPathInKey(path, key string) bool
- func Int32ToString(val int) string
- func Int64ToString(val int64) string
- func IsArrayIndex(path string) bool
- func IsArrayPath(path string, keys []string) bool
- func LengthOfArrayPath(path string, keys []string) int
- func PathCombine(path ...string) string
- func StringToBoolean(val string) (bool, error)
- func StringToByte(val string) (byte, error)
- func StringToFloat32(val string) (float32, error)
- func StringToFloat64(val string) (float64, error)
- func StringToInt32(val string) (int, error)
- func StringToInt64(val string) (int64, error)
- func StringToUint32(val string) (uint, error)
- func StringToUint64(val string) (uint64, error)
- func Uint32ToString(val uint32) string
- func Uint64ToString(val uint64) string
- type Change
- type ChangeMode
- type ChangeToken
- type Conf
- type ConfArraySection
- type ConfBase
- type ConfBuilder
- type ConfChanges
- type ConfProvider
- type ConfRoot
- type ConfSection
- type ConfSource
- type EnvConfSource
- type FileConfProvider
- type FileConfSource
- type FileInfo
- type JsonConfSource
- type JsonFileConfSource
- func (s *JsonFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
- func (s *JsonFileConfSource) GetFileInfo() FileInfo
- func (s *JsonFileConfSource) GetFilePath() string
- func (s *JsonFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
- func (s *JsonFileConfSource) IsEndureIfNotExist() bool
- func (s *JsonFileConfSource) IsFileExist() bool
- func (s *JsonFileConfSource) Load() (map[string]interface{}, error)
- func (s *JsonFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
- func (s *JsonFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
- type KeyValuePair
- type MemConfSource
- type StringSplitter
- type TomlConfSource
- type TomlFileConfSource
- func (s *TomlFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
- func (s *TomlFileConfSource) GetFileInfo() FileInfo
- func (s *TomlFileConfSource) GetFilePath() string
- func (s *TomlFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
- func (s *TomlFileConfSource) IsEndureIfNotExist() bool
- func (s *TomlFileConfSource) IsFileExist() bool
- func (s *TomlFileConfSource) Load() (map[string]interface{}, error)
- func (s *TomlFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
- func (s *TomlFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
- type TypeConverter
- func (t *TypeConverter) GetBoolean(key string) (bool, error)
- func (t *TypeConverter) GetByte(key string) (byte, error)
- func (t *TypeConverter) GetComplex128(key string) (complex128, error)
- func (t *TypeConverter) GetComplex64(key string) (complex64, error)
- func (t *TypeConverter) GetFloat32(key string) (float32, error)
- func (t *TypeConverter) GetFloat64(key string) (float64, error)
- func (t *TypeConverter) GetInt(key string) (int, error)
- func (t *TypeConverter) GetInt64(key string) (int64, error)
- func (t *TypeConverter) GetString(key string) (string, error)
- func (t *TypeConverter) GetUint(key string) (uint, error)
- func (t *TypeConverter) GetUint64(key string) (uint64, error)
- func (t *TypeConverter) TryGetBoolean(key string, defaultValue bool) bool
- func (t *TypeConverter) TryGetByte(key string, defaultValue byte) byte
- func (t *TypeConverter) TryGetComplex128(key string, defaultValue complex128) complex128
- func (t *TypeConverter) TryGetComplex64(key string, defaultValue complex64) complex64
- func (t *TypeConverter) TryGetFloat32(key string, defaultValue float32) float32
- func (t *TypeConverter) TryGetFloat64(key string, defaultValue float64) float64
- func (t *TypeConverter) TryGetInt(key string, defaultValue int) int
- func (t *TypeConverter) TryGetInt64(key string, defaultValue int64) int64
- func (t *TypeConverter) TryGetString(key string, defaultValue string) string
- func (t *TypeConverter) TryGetUint(key string, defaultValue uint) uint
- func (t *TypeConverter) TryGetUint64(key string, defaultValue uint64) uint64
- type Watcher
- type YamlConfSource
- type YamlFileConfSource
- func (s *YamlFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
- func (s *YamlFileConfSource) GetFileInfo() FileInfo
- func (s *YamlFileConfSource) GetFilePath() string
- func (s *YamlFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
- func (s *YamlFileConfSource) IsEndureIfNotExist() bool
- func (s *YamlFileConfSource) IsFileExist() bool
- func (s *YamlFileConfSource) Load() (map[string]interface{}, error)
- func (s *YamlFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
- func (s *YamlFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
Constants ¶
View Source
const ( PathDelimiter = "/" RootPath = "/" ArrayDelimiter = "$" )
Variables ¶
This section is empty.
Functions ¶
func BooleanToString ¶
func ByteToString ¶
func FindChildKeys ¶
func Float32ToString ¶
func Float64ToString ¶
func GetArrayIndex ¶
func GetArrayIndexPath ¶
func GetParentPath ¶
func GetSectionKey ¶
func HasPathInKey ¶
func Int32ToString ¶
func Int64ToString ¶
func IsArrayIndex ¶
func IsArrayPath ¶
func LengthOfArrayPath ¶
func PathCombine ¶
func StringToBoolean ¶
func StringToByte ¶
func StringToFloat32 ¶
func StringToFloat64 ¶
func StringToInt32 ¶
func StringToInt64 ¶
func StringToUint32 ¶
func StringToUint64 ¶
func Uint32ToString ¶
func Uint64ToString ¶
Types ¶
type Change ¶
type Change struct { KeyName string Mode ChangeMode Prev interface{} Current interface{} }
type ChangeToken ¶
type ChangeToken interface { SetCallback(callback func()) HasChanged() bool SetAsChanged() OnChanged() }
func NewChangeToken ¶
func NewChangeToken() ChangeToken
type Conf ¶
type Conf interface { ConfBase GetBoolean(key string) (bool, error) GetByte(key string) (byte, error) GetInt(key string) (int, error) GetInt64(key string) (int64, error) GetUint(key string) (uint, error) GetUint64(key string) (uint64, error) GetFloat32(key string) (float32, error) GetFloat64(key string) (float64, error) GetComplex64(key string) (complex64, error) GetComplex128(key string) (complex128, error) GetString(key string) (string, error) TryGet(key string, defaultValue interface{}) interface{} TryGetBoolean(key string, defaultValue bool) bool TryGetByte(key string, defaultValue byte) byte TryGetInt(key string, defaultValue int) int TryGetInt64(key string, defaultValue int64) int64 TryGetUint(key string, defaultValue uint) uint TryGetUint64(key string, defaultValue uint64) uint64 TryGetFloat32(key string, defaultValue float32) float32 TryGetFloat64(key string, defaultValue float64) float64 TryGetComplex64(key string, defaultValue complex64) complex64 TryGetComplex128(key string, defaultValue complex128) complex128 TryGetString(key string, defaultValue string) string GetSection(key string) ConfSection GetArraySection(key string) ConfArraySection }
type ConfArraySection ¶
type ConfArraySection interface { Conf Length() int GetIndexSection(idx int) ConfSection }
func NewConfArraySection ¶
func NewConfArraySection(root ConfRoot, path string) ConfArraySection
type ConfBuilder ¶
type ConfBuilder interface { Add(confSource ConfSource) ConfBuilder GetSources() []ConfSource Build() (ConfRoot, error) }
func NewConfBuilder ¶
func NewConfBuilder() ConfBuilder
type ConfChanges ¶
func CalcConfChanges ¶
func CalcConfChanges(current map[string]interface{}, prev map[string]interface{}) ConfChanges
func EmptyConfChanges ¶
func EmptyConfChanges() ConfChanges
type ConfProvider ¶
type ConfProvider interface { Conf Load() error Reload() error Dispose() GetChangeToken() ChangeToken }
func NewConfProvider ¶
func NewConfProvider(source ConfSource) (ConfProvider, error)
type ConfSection ¶
type ConfSection interface { Conf }
func NewConfSection ¶
func NewConfSection(root ConfRoot, path string) ConfSection
type ConfSource ¶
type ConfSource interface { Build(confBuilder ConfBuilder) (ConfProvider, error) Load() (map[string]interface{}, error) }
type EnvConfSource ¶
type EnvConfSource struct {
// contains filtered or unexported fields
}
func NewEnvConfSource ¶
func NewEnvConfSource() *EnvConfSource
func (*EnvConfSource) Build ¶
func (s *EnvConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*EnvConfSource) Load ¶
func (s *EnvConfSource) Load() (map[string]interface{}, error)
func (*EnvConfSource) SetPrefix ¶
func (s *EnvConfSource) SetPrefix(prefix string) *EnvConfSource
type FileConfProvider ¶
type FileConfProvider interface { ConfProvider OnChanged() }
func NewFileConfProvider ¶
func NewFileConfProvider(source FileConfSource) (FileConfProvider, error)
type FileConfSource ¶
type FileConfSource interface { ConfSource SetEndureIfNotExist(bool) FileConfSource SetOnConfChangedCallback(func(ConfChanges)) FileConfSource GetOnConfChangedCallback() func(ConfChanges) GetFileInfo() FileInfo GetFilePath() string IsEndureIfNotExist() bool IsFileExist() bool }
type FileInfo ¶
type FileInfo interface { Exists() bool IsDirectory() bool LastModified() time.Time GetLength() int64 GetName() string GetPhysicalPath() string ReadAll() ([]byte, error) }
func NewFileInfo ¶
type JsonConfSource ¶
type JsonConfSource struct {
// contains filtered or unexported fields
}
func NewJsonConfSource ¶
func NewJsonConfSource(jsonMessage []byte) *JsonConfSource
func (*JsonConfSource) Build ¶
func (s *JsonConfSource) Build(confBuilder ConfBuilder) (ConfProvider, error)
func (*JsonConfSource) Load ¶
func (s *JsonConfSource) Load() (map[string]interface{}, error)
type JsonFileConfSource ¶
type JsonFileConfSource struct {
// contains filtered or unexported fields
}
func NewJsonFileConfSource ¶
func NewJsonFileConfSource(path string) *JsonFileConfSource
func (*JsonFileConfSource) Build ¶
func (s *JsonFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*JsonFileConfSource) GetFileInfo ¶
func (s *JsonFileConfSource) GetFileInfo() FileInfo
func (*JsonFileConfSource) GetFilePath ¶
func (s *JsonFileConfSource) GetFilePath() string
func (*JsonFileConfSource) GetOnConfChangedCallback ¶
func (s *JsonFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
func (*JsonFileConfSource) IsEndureIfNotExist ¶
func (s *JsonFileConfSource) IsEndureIfNotExist() bool
func (*JsonFileConfSource) IsFileExist ¶
func (s *JsonFileConfSource) IsFileExist() bool
func (*JsonFileConfSource) Load ¶
func (s *JsonFileConfSource) Load() (map[string]interface{}, error)
func (*JsonFileConfSource) SetEndureIfNotExist ¶
func (s *JsonFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
func (*JsonFileConfSource) SetOnConfChangedCallback ¶
func (s *JsonFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
type KeyValuePair ¶
type KeyValuePair struct { Key string Value interface{} }
func FindChildPairs ¶
func FindChildPairs(basePath string, pairs []KeyValuePair) []KeyValuePair
type MemConfSource ¶
type MemConfSource struct { }
func NewMapConfSource ¶
func NewMapConfSource(conf map[string]interface{}) *MemConfSource
func (*MemConfSource) Build ¶
func (s *MemConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*MemConfSource) Load ¶
func (s *MemConfSource) Load() (map[string]interface{}, error)
type StringSplitter ¶
type StringSplitter struct {
// contains filtered or unexported fields
}
func NewStringSplitter ¶
func NewStringSplitter(str string) StringSplitter
type TomlConfSource ¶
type TomlConfSource struct {
// contains filtered or unexported fields
}
func NewTomlConfSource ¶
func NewTomlConfSource(tomlMessage []byte) *TomlConfSource
func (*TomlConfSource) Build ¶
func (s *TomlConfSource) Build(confBuilder ConfBuilder) (ConfProvider, error)
func (*TomlConfSource) Load ¶
func (s *TomlConfSource) Load() (map[string]interface{}, error)
type TomlFileConfSource ¶
type TomlFileConfSource struct {
// contains filtered or unexported fields
}
func NewTomlFileConfSource ¶
func NewTomlFileConfSource(path string) *TomlFileConfSource
func (*TomlFileConfSource) Build ¶
func (s *TomlFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*TomlFileConfSource) GetFileInfo ¶
func (s *TomlFileConfSource) GetFileInfo() FileInfo
func (*TomlFileConfSource) GetFilePath ¶
func (s *TomlFileConfSource) GetFilePath() string
func (*TomlFileConfSource) GetOnConfChangedCallback ¶
func (s *TomlFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
func (*TomlFileConfSource) IsEndureIfNotExist ¶
func (s *TomlFileConfSource) IsEndureIfNotExist() bool
func (*TomlFileConfSource) IsFileExist ¶
func (s *TomlFileConfSource) IsFileExist() bool
func (*TomlFileConfSource) Load ¶
func (s *TomlFileConfSource) Load() (map[string]interface{}, error)
func (*TomlFileConfSource) SetEndureIfNotExist ¶
func (s *TomlFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
func (*TomlFileConfSource) SetOnConfChangedCallback ¶
func (s *TomlFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
type TypeConverter ¶
type TypeConverter struct {
// contains filtered or unexported fields
}
func NewTypeConverter ¶
func NewTypeConverter(confBase ConfBase) TypeConverter
func (*TypeConverter) GetBoolean ¶
func (t *TypeConverter) GetBoolean(key string) (bool, error)
func (*TypeConverter) GetComplex128 ¶
func (t *TypeConverter) GetComplex128(key string) (complex128, error)
func (*TypeConverter) GetComplex64 ¶
func (t *TypeConverter) GetComplex64(key string) (complex64, error)
func (*TypeConverter) GetFloat32 ¶
func (t *TypeConverter) GetFloat32(key string) (float32, error)
func (*TypeConverter) GetFloat64 ¶
func (t *TypeConverter) GetFloat64(key string) (float64, error)
func (*TypeConverter) TryGetBoolean ¶
func (t *TypeConverter) TryGetBoolean(key string, defaultValue bool) bool
func (*TypeConverter) TryGetByte ¶
func (t *TypeConverter) TryGetByte(key string, defaultValue byte) byte
func (*TypeConverter) TryGetComplex128 ¶
func (t *TypeConverter) TryGetComplex128(key string, defaultValue complex128) complex128
func (*TypeConverter) TryGetComplex64 ¶
func (t *TypeConverter) TryGetComplex64(key string, defaultValue complex64) complex64
func (*TypeConverter) TryGetFloat32 ¶
func (t *TypeConverter) TryGetFloat32(key string, defaultValue float32) float32
func (*TypeConverter) TryGetFloat64 ¶
func (t *TypeConverter) TryGetFloat64(key string, defaultValue float64) float64
func (*TypeConverter) TryGetInt ¶
func (t *TypeConverter) TryGetInt(key string, defaultValue int) int
func (*TypeConverter) TryGetInt64 ¶
func (t *TypeConverter) TryGetInt64(key string, defaultValue int64) int64
func (*TypeConverter) TryGetString ¶
func (t *TypeConverter) TryGetString(key string, defaultValue string) string
func (*TypeConverter) TryGetUint ¶
func (t *TypeConverter) TryGetUint(key string, defaultValue uint) uint
func (*TypeConverter) TryGetUint64 ¶
func (t *TypeConverter) TryGetUint64(key string, defaultValue uint64) uint64
type Watcher ¶
type Watcher interface { Watch(reloadToken ChangeToken) error IsWatching() bool Close() error }
func NewFileWatcher ¶
type YamlConfSource ¶
type YamlConfSource struct {
// contains filtered or unexported fields
}
func NewYamlConfSource ¶
func NewYamlConfSource(yamlMessage []byte) *YamlConfSource
func (*YamlConfSource) Build ¶
func (s *YamlConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*YamlConfSource) Load ¶
func (s *YamlConfSource) Load() (map[string]interface{}, error)
type YamlFileConfSource ¶
type YamlFileConfSource struct {
// contains filtered or unexported fields
}
func NewYamlFileConfSource ¶
func NewYamlFileConfSource(path string) *YamlFileConfSource
func (*YamlFileConfSource) Build ¶
func (s *YamlFileConfSource) Build(builder ConfBuilder) (ConfProvider, error)
func (*YamlFileConfSource) GetFileInfo ¶
func (s *YamlFileConfSource) GetFileInfo() FileInfo
func (*YamlFileConfSource) GetFilePath ¶
func (s *YamlFileConfSource) GetFilePath() string
func (*YamlFileConfSource) GetOnConfChangedCallback ¶
func (s *YamlFileConfSource) GetOnConfChangedCallback() func(ConfChanges)
func (*YamlFileConfSource) IsEndureIfNotExist ¶
func (s *YamlFileConfSource) IsEndureIfNotExist() bool
func (*YamlFileConfSource) IsFileExist ¶
func (s *YamlFileConfSource) IsFileExist() bool
func (*YamlFileConfSource) Load ¶
func (s *YamlFileConfSource) Load() (map[string]interface{}, error)
func (*YamlFileConfSource) SetEndureIfNotExist ¶
func (s *YamlFileConfSource) SetEndureIfNotExist(endureIfNotExist bool) FileConfSource
func (*YamlFileConfSource) SetOnConfChangedCallback ¶
func (s *YamlFileConfSource) SetOnConfChangedCallback(onConfChangedCallback func(ConfChanges)) FileConfSource
Source Files ¶
- change_token.go
- conf_array.go
- conf_builder.go
- conf_changes.go
- conf_iface.go
- conf_provider.go
- conf_root.go
- conf_section.go
- env_conf.go
- file_conf_iface.go
- file_conf_provider.go
- file_info.go
- file_watcher.go
- gconf.go
- json_conf.go
- json_file_conf.go
- mem_conf.go
- path.go
- toml_conf.go
- toml_file_conf.go
- type_converter.go
- util.go
- yaml_conf.go
- yaml_file_conf.go
Click to show internal directories.
Click to hide internal directories.