Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMultipleDataSourcesSpecified = errors.New("more than one data source specified; only call one of Bytes(), String(), Reader() or Path()")
ErrNoDataSourceSpecified is thrown if more than one of Bytes, String, Path or Reader of the EnvSourceSetupStepOne interface have been called.
View Source
var ErrNoDataSourceSpecified = errors.New("no data source specified; call Bytes(), String(), Reader() or Path()")
ErrNoDataSourceSpecified is thrown if none Bytes, String, Path or Reader of the EnvSourceSetupStepOne interface have been called.
Functions ¶
This section is empty.
Types ¶
type EnvSourceOptionalSetup ¶
type EnvSourceOptionalSetup[T yagcl.Source] interface { yagcl.Source // Prefix specified the prefixes expected in environment variable keys. // For example "PREFIX_FIELD_NAME". Prefix(string) T // KeyValueConverter defines how the yagcl.DefaultKeyTagName value should be // converted for this source. If you are setting this, you'll most likely // also have to set EnvSource.KeyJoiner(string,string) string. // Note that calling this isn't required, as there's a best practise default // behaviour. KeyValueConverter(func(string) string) T // 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, depending. In combination // with KeyValueConverter, this could then become SUB_FIELD. KeyJoiner(func(string, string) string) T }
type EnvSourceSetupStepOne ¶
type EnvSourceSetupStepOne[T yagcl.Source] interface { // Bytes defines a byte array to read from directly. Bytes([]byte) EnvSourceSetupStepTwoEnvFile[T] // Bytes defines a string to read from directly. String(string) EnvSourceSetupStepTwoEnvFile[T] // Path defines a filepath that is accessed when YAGCL.Parse is called. Path(string) EnvSourceSetupStepTwoEnvFile[T] // Reader defines a reader that is accessed when YAGCL.Parse is called. IF // available, io.Closer.Close() is called. Reader(io.Reader) EnvSourceSetupStepTwoEnvFile[T] // Env instructs the source to read directly from the environment // variables. Env() EnvSourceSetupStepTwoEnv[T] }
func Source ¶
func Source() EnvSourceSetupStepOne[*envSourceImpl]
Source creates a source for environment variables of the current process.
type EnvSourceSetupStepTwoEnv ¶
type EnvSourceSetupStepTwoEnv[T yagcl.Source] interface { EnvSourceOptionalSetup[T] }
type EnvSourceSetupStepTwoEnvFile ¶
type EnvSourceSetupStepTwoEnvFile[T yagcl.Source] interface { EnvSourceOptionalSetup[T] // LoadIntoEnv activates loading the unparsed data into the environment // variables of the process. LoadIntoEnv() T // Must declares this source as mandatory, erroring in case no data can // be loaded. In case of loading directly from the environment, this // will always succeed though, as the environment is always there, even // if we can't load any values, due to the fact they aren't available. Must() T }
Click to show internal directories.
Click to hide internal directories.