configuration

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KeyDelimiter = ":"

Variables

This section is empty.

Functions

func Fill

func Fill(root IConfiguration, path string, out any)

func Get

func Get[T any](root IConfiguration, path string) T

func GetBool

func GetBool(config IConfiguration, key string) bool

func GetByType

func GetByType(ty reflect.Type, root IConfiguration, path string) any

func GetFloat64

func GetFloat64(config IConfiguration, key string) float64

func GetInt64

func GetInt64(config IConfiguration, key string) int64

func GetUint64

func GetUint64(config IConfiguration, key string) uint64

func TryGetBool

func TryGetBool(config IConfiguration, key string) (bool, bool)

func TryGetFloat64

func TryGetFloat64(config IConfiguration, key string) (float64, bool)

func TryGetInt64

func TryGetInt64(config IConfiguration, key string) (int64, bool)

func TryGetUint64

func TryGetUint64(config IConfiguration, key string) (uint64, bool)

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddSource

func (ss *Builder) AddSource(source IConfigurationSource)

func (*Builder) BuildConfigurationRoot

func (ss *Builder) BuildConfigurationRoot() IConfigurationRoot

func (*Builder) GetProperties

func (ss *Builder) GetProperties() container.Map[string, any]

func (*Builder) GetSources

func (ss *Builder) GetSources() container.List[IConfigurationSource]

type IConfiguration

type IConfiguration interface {
	Get(key string) string
	TryGet(key string) (value string, ok bool)
	Set(key string, value string)
	GetSection(key string) IConfigurationSection
	GetChildren() container.List[IConfigurationSection]
	GetChildrenByPath(path string) container.List[IConfigurationSection]
	GetReloadNotifier() notifier.INotifier
}

type IConfigurationBuilder

type IConfigurationBuilder interface {
	GetProperties() container.Map[string, any]
	GetSources() container.List[IConfigurationSource]
	AddSource(source IConfigurationSource)
	BuildConfigurationRoot() IConfigurationRoot
}

type IConfigurationManager

type IConfigurationManager interface {
	IConfigurationBuilder
	IConfigurationRoot
}

type IConfigurationProvider

type IConfigurationProvider interface {
	Get(key string) string
	TryGet(key string) (value string, ok bool)
	Set(key string, value string)
	GetReloadNotifier() notifier.INotifier
	Load()
	GetChildKeys(parentPath string) container.List[string]
}

type IConfigurationRoot

type IConfigurationRoot interface {
	IConfiguration

	Reload()
	GetProviders() container.List[IConfigurationProvider]
}

func NewConfigurationRoot

func NewConfigurationRoot(providers container.List[IConfigurationProvider]) IConfigurationRoot

type IConfigurationSection

type IConfigurationSection interface {
	IConfiguration

	GetKey() string
	GetPath() string
	GetValue() (string, bool)
	SetValue(key string, value string)
}

type IConfigurationSource

type IConfigurationSource interface {
	BuildConfigurationProvider(builder IConfigurationBuilder) IConfigurationProvider
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) AddSource

func (ss *Manager) AddSource(source IConfigurationSource)

func (*Manager) BuildConfigurationRoot

func (ss *Manager) BuildConfigurationRoot() IConfigurationRoot

func (*Manager) Get

func (ss *Manager) Get(key string) string

func (*Manager) GetChildren

func (ss *Manager) GetChildren() container.List[IConfigurationSection]

func (*Manager) GetChildrenByPath

func (ss *Manager) GetChildrenByPath(path string) container.List[IConfigurationSection]

func (*Manager) GetProperties

func (ss *Manager) GetProperties() container.Map[string, any]

func (*Manager) GetProviders

func (ss *Manager) GetProviders() container.List[IConfigurationProvider]

func (*Manager) GetReloadNotifier

func (ss *Manager) GetReloadNotifier() notifier.INotifier

func (*Manager) GetSection

func (ss *Manager) GetSection(key string) IConfigurationSection

func (*Manager) GetSources

func (ss *Manager) GetSources() container.List[IConfigurationSource]

func (*Manager) Reload

func (ss *Manager) Reload()

func (*Manager) Set

func (ss *Manager) Set(key string, value string)

func (*Manager) TryGet

func (ss *Manager) TryGet(key string) (value string, ok bool)

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) Notify

func (ss *Notifier) Notify()

func (*Notifier) RegisterNotifyCallback

func (ss *Notifier) RegisterNotifyCallback(callback func())

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider() *Provider

func (*Provider) Get

func (ss *Provider) Get(key string) string

func (*Provider) GetChildKeys

func (ss *Provider) GetChildKeys(parentPath string) container.List[string]

func (*Provider) GetReloadNotifier

func (ss *Provider) GetReloadNotifier() notifier.INotifier

func (*Provider) Load

func (ss *Provider) Load()

func (*Provider) OnReload

func (ss *Provider) OnReload()

func (*Provider) Replace

func (ss *Provider) Replace(data *container.CaseInsensitiveStringMap[string])

func (*Provider) Set

func (ss *Provider) Set(key string, value string)

func (*Provider) TryGet

func (ss *Provider) TryGet(key string) (value string, ok bool)

type Root

type Root struct {
	// contains filtered or unexported fields
}

func (*Root) Get

func (ss *Root) Get(key string) string

func (*Root) GetChildren

func (ss *Root) GetChildren() container.List[IConfigurationSection]

func (*Root) GetChildrenByPath

func (ss *Root) GetChildrenByPath(path string) container.List[IConfigurationSection]

func (*Root) GetProviders

func (ss *Root) GetProviders() container.List[IConfigurationProvider]

func (*Root) GetReloadNotifier

func (ss *Root) GetReloadNotifier() notifier.INotifier

func (*Root) GetSection

func (ss *Root) GetSection(key string) IConfigurationSection

func (*Root) Reload

func (ss *Root) Reload()

func (*Root) Set

func (ss *Root) Set(key string, value string)

func (*Root) TryGet

func (ss *Root) TryGet(key string) (value string, ok bool)

type Section

type Section struct {
	// contains filtered or unexported fields
}

func NewSection

func NewSection(root IConfigurationRoot, path string) *Section

func (*Section) Get

func (ss *Section) Get(key string) string

func (*Section) GetChildren

func (ss *Section) GetChildren() container.List[IConfigurationSection]

func (*Section) GetChildrenByPath

func (ss *Section) GetChildrenByPath(path string) container.List[IConfigurationSection]

func (*Section) GetKey

func (ss *Section) GetKey() string

func (*Section) GetPath

func (ss *Section) GetPath() string

func (*Section) GetReloadNotifier

func (ss *Section) GetReloadNotifier() notifier.INotifier

func (*Section) GetSection

func (ss *Section) GetSection(key string) IConfigurationSection

func (*Section) GetValue

func (ss *Section) GetValue() (string, bool)

func (*Section) Set

func (ss *Section) Set(key string, value string)

func (*Section) SetValue

func (ss *Section) SetValue(key, value string)

func (*Section) TryGet

func (ss *Section) TryGet(key string) (value string, ok bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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