Documentation
¶
Index ¶
- type EnvSource
- func (s *EnvSource) KeyJoiner(keyJoiner func(string, string) string) *EnvSource
- func (s *EnvSource) KeyTag() string
- func (s *EnvSource) KeyValueConverter(keyValueConverter func(string) string) *EnvSource
- func (s *EnvSource) Parse(configurationStruct any) (bool, error)
- func (s *EnvSource) Prefix(prefix string) *EnvSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvSource ¶
type EnvSource struct {
// contains filtered or unexported fields
}
DO NOT CREATE INSTANCES MANUALLY, THIS IS ONLY PUBLIC IN ORDER FOR GODOC TO RENDER AVAILABLE FUNCTIONS.
func Source ¶
func Source() *EnvSource
Source creates a source for environment variables of the current process.
func (*EnvSource) KeyJoiner ¶
KeyJoiner defines the function that builds the environment variable keys. For example consider the following struct:
type Config struct {
Sub struct {
Field int `key:"field"`
} `key:"sub"`
}
The joiner could for example produce SUB_FIELD or subField, depending on what the programmer desires. By default this function is set to uppercase and connecting with underscores, preventing duplicate underscores.
func (*EnvSource) KeyValueConverter ¶
KeyValueConverter defines how the yagcl.DefaultKeyTagName value should be converted for this source. If you are setting this, you'll most liekly also have to set EnvSource.KeyJoiner(string,string) string. Note that calling this isn't required, as there's a best practise default behaviour.