Documentation
¶
Index ¶
- func SimplifyPrefix(prefix string) string
- type Extractor
- func (e *Extractor) AddEnvToUsage(usage string, envName string) string
- func (e *Extractor) Bool(name string, destination *bool) bool
- func (e *Extractor) ExtractAll(vars []*Var) error
- func (e *Extractor) ExtractAllVars(vars ...*Var) error
- func (e *Extractor) Int(name string, destination *int) (bool, error)
- func (e *Extractor) NameWithPrefix(name string) string
- func (e *Extractor) String(name string, destination *string) bool
- func (e *Extractor) StringWithoutPrefix(name string, destination *string) bool
- func (e *Extractor) Strings(name string, destination *[]string) bool
- func (e *Extractor) WithPrefixSeparator(s string) *Extractor
- func (e *Extractor) WithSliceSeparator(s string) *Extractor
- type LookupFunc
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SimplifyPrefix ¶
SimplifyPrefix This method trim right all _ ang - symbols and spaces left and right.
Types ¶
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
func NewExtractor ¶
func NewExtractor(prefix string, lookupFunc LookupFunc) *Extractor
NewExtractor utils for extract env and pass to destination by default extractor use _ for separate prefix and env name if need we use WithPrefixSeparator method for set your own or set to empty by default slice string extractor split env string by , symbol if need we use WithSliceSeparator method for set your own slice separator
func NewOsExtractor ¶
NewOsExtractor create extractor with os.LookupEnv lookup function
func (*Extractor) AddEnvToUsage ¶
func (*Extractor) Bool ¶
Bool trim spaces env and to lower value string lower value string "false" "no" "none" "0" interpreter as false returns that env is set
func (*Extractor) ExtractAll ¶
ExtractAll extract all envs from map if env present but have empty value set Var Present field to true you can process it if need ExtractAll found need type for Destination, but destination should be pointer Warning! if error returned some Destination can be set
func (*Extractor) ExtractAllVars ¶
ExtractAllVars same as ExtractAll but can pass as variadic arguments
func (*Extractor) NameWithPrefix ¶
func (*Extractor) StringWithoutPrefix ¶
func (*Extractor) WithPrefixSeparator ¶
func (*Extractor) WithSliceSeparator ¶
WithSliceSeparator set only not empty string