MCPcopy Create free account

hub / github.com/caarlos0/env / functions

Functions212 in github.com/caarlos0/env

↓ 90 callersFunctionParse
Parse parses a struct containing `env` tags and loads its values from environment variables.
env.go:286
↓ 67 callersFunctionisNoErr
(tb testing.TB, err error)
env_test.go:1926
↓ 62 callersFunctionisEqual
(tb testing.TB, a, b interface{})
env_test.go:1934
↓ 53 callersFunctionisTrue
(tb testing.TB, b bool)
env_test.go:1898
↓ 51 callersMethodIs
Is conforms with errors.Is.
error.go:50
↓ 45 callersFunctionisErrorWithMessage
(tb testing.TB, err error, msg string)
env_test.go:1914
↓ 41 callersFunctionParseWithOptions
ParseWithOptions parses a struct containing `env` tags and loads its values from environment variables.
env.go:292
↓ 5 callersFunctionnewParseError
(sf reflect.StructField, err error)
error.go:66
↓ 4 callersFunctionparseInternal
(v interface{}, processField processFieldFn, opts Options)
env.go:347
↓ 3 callersFunctionareEqual
copied from https://github.com/matryer/is
env_test.go:1945
↓ 3 callersFunctiondefaultOptions
()
env.go:199
↓ 3 callersFunctiondoParse
(ref reflect.Value, processField processFieldFn, opts Options)
env.go:360
↓ 3 callersFunctionnewNoParserError
(sf reflect.StructField)
error.go:87
↓ 3 callersFunctionnewParseValueError
(message string, err error)
error.go:167
↓ 2 callersMethodError
()
error.go:70
↓ 2 callersFunctionGetFieldParams
GetFieldParams parses a struct containing `env` tags and returns information about tags it found.
env.go:322
↓ 2 callersFunctionGetFieldParamsWithOptions
GetFieldParamsWithOptions parses a struct containing `env` tags and returns information about tags it found.
env.go:328
↓ 2 callersFunctionToMap
ToMap Converts list of env vars as provided by os.Environ() to map you can use as Options.Environment field
env.go:865
↓ 2 callersMethodUnmarshalText
(text []byte)
env_test.go:1574
↓ 2 callersFunctioncustomOptions
(opts Options)
env.go:246
↓ 2 callersFunctionisFalse
(tb testing.TB, b bool)
env_test.go:1906
↓ 2 callersFunctionnewAggregateError
(initErr error)
error.go:24
↓ 2 callersFunctiontoEnvName
(input string)
env.go:528
↓ 2 callersFunctiontoMap
(env []string)
env_tomap.go:7
↓ 1 callersFunctionMust
Must panic is if err is not nil, and returns t otherwise.
env.go:313
↓ 1 callersFunctionasTextUnmarshaler
(field reflect.Value)
env.go:821
↓ 1 callersFunctiondefaultTypeParsers
()
env.go:85
↓ 1 callersFunctiondoParseField
( refField reflect.Value, refTypeField reflect.StructField, processField processFieldFn, opts Options, )
env.go:385
↓ 1 callersFunctiondoParseSlice
(ref reflect.Value, processField processFieldFn, opts Options)
env.go:449
↓ 1 callersMethodexpand
expand replaces ${var} or $var in val, expanding the values it refers to as well. visiting holds the variables being expanded, so a reference back to
env.go:183
↓ 1 callersFunctionget
(fieldParams FieldParams, opts Options)
env.go:605
↓ 1 callersFunctiongetFromFile
(filename string)
env.go:661
↓ 1 callersFunctiongetOr
(key, defaultValue string, defExists bool, envs map[string]string)
env.go:666
↓ 1 callersFunctionhandleMap
(field reflect.Value, value string, sf reflect.StructField, funcMap map[reflect.Type]ParserFunc)
env.go:768
↓ 1 callersFunctionhandleSlice
(field reflect.Value, value string, sf reflect.StructField, funcMap map[reflect.Type]ParserFunc)
env.go:727
↓ 1 callersFunctionisInvalidPtr
(v reflect.Value)
env.go:869
↓ 1 callersFunctionisNil
copied from https://github.com/matryer/is
env_test.go:1961
↓ 1 callersFunctionisSliceOfStructs
(refTypeField reflect.StructField)
env.go:430
↓ 1 callersFunctionisZero
(v reflect.Value)
env.go:236
↓ 1 callersFunctionmergeOptions
(target, source *T)
env.go:210
↓ 1 callersFunctionnewEmptyVarError
(key string)
error.go:138
↓ 1 callersFunctionnewLoadFileContentError
(filename, key string, err error)
error.go:153
↓ 1 callersFunctionnewNoSupportedTagOptionError
(tag string)
error.go:102
↓ 1 callersFunctionnewVarIsNotSetError
(key string)
error.go:120
↓ 1 callersFunctionoptionsWithEnvPrefix
(field reflect.StructField, opts Options)
env.go:268
↓ 1 callersFunctionoptionsWithSliceEnvPrefix
(opts Options, index int)
env.go:252
↓ 1 callersFunctionparseFieldParams
(field reflect.StructField, opts Options)
env.go:562
↓ 1 callersFunctionparseKeyForOption
split the env tag's key into the expected key and desired option, if any.
env.go:656
↓ 1 callersFunctionparseTextUnmarshalers
(field reflect.Value, data []string, sf reflect.StructField)
env.go:837
↓ 1 callersFunctionset
(field reflect.Value, sf reflect.StructField, value string, funcMap map[reflect.Type]ParserFunc)
env.go:680
MethodError
()
error.go:32
MethodError
()
error.go:77
MethodError
()
error.go:91
MethodError
()
error.go:106
MethodError
()
error.go:124
MethodError
()
error.go:142
MethodError
()
error.go:157
MethodError
()
error.go:171
FunctionExample
Basic package usage example.
example_test.go:11
FunctionExampleParse
Parse the environment into a struct.
example_test.go:30
FunctionExampleParseAs
Parse the environment into a struct using generics.
example_test.go:44
FunctionExampleParseWithOptions_allFieldsRequired
Make all fields required by default.
example_test.go:260
FunctionExampleParseWithOptions_customTypes
Parse using extra options.
example_test.go:233
FunctionExampleParseWithOptions_onSet
You might want to listen to value sets and, for example, log something or do some other kind of logic.
example_test.go:179
FunctionExampleParseWithOptions_prefix
Setting prefixes for the entire config.
example_test.go:341
FunctionExampleParseWithOptions_setEnv
Set a custom environment. By default, `os.Environ()` is used.
example_test.go:279
FunctionExampleParseWithOptions_tagName
Use a different tag name than `env` and `envDefault`.
example_test.go:357
FunctionExampleParseWithOptions_useFieldName
If you don't want to set the `env` tag on every field, you can use the `UseFieldNameByDefault` option. It will use the field name to define the envir
example_test.go:379
FunctionExampleParse_complexSlices
Handling slices of complex types.
example_test.go:299
FunctionExampleParse_customTimeFormat
By default, env supports anything that implements the `TextUnmarshaler` interface, which includes `time.Time`. The upside is that depending on the fo
example_test.go:211
FunctionExampleParse_errorHandling
TODO: envSeperator
example_test.go:420
FunctionExampleParse_expand
If you set the `expand` option, environment variables (either in `${var}` or `$var` format) in the string will be replaced according with the actual v
example_test.go:123
FunctionExampleParse_fromFile
The `env` tag option `file` (e.g., `env:"tagKey,file"`) can be added in order to indicate that the value of the variable shall be loaded from a file.
example_test.go:400
FunctionExampleParse_init
You can automatically initialize `nil` pointers regardless of if a variable is set for them or not. This behavior can be enabled by using the `init` t
example_test.go:141
FunctionExampleParse_notEmpty
While `required` demands the environment variable to be set, it doesn't check its value. If you want to make sure the environment is set and not empty
example_test.go:73
FunctionExampleParse_prefix
Setting prefixes for inner types.
example_test.go:322
FunctionExampleParse_required
()
example_test.go:57
FunctionExampleParse_separator
You can use `envSeparator` to define which character should be used to separate array items in a string. Similarly, you can use `envKeyValSeparator` t
example_test.go:107
FunctionExampleParse_setDefaults
You can define the default value for a field by either using the `envDefault` tag, or when initializing the `struct`. Default values defined as `stru
example_test.go:162
FunctionExampleParse_unset
The `env` tag option `unset` (e.g., `env:"tagKey,unset"`) can be added to ensure that some environment variable is unset after reading it.
example_test.go:89
FunctionExample_parseEmptyEnvFallsBackToDefault
An environment variable that is set but empty falls back to envDefault.
example_test.go:485
FunctionExample_setDefaultsForZeroValuesOnly
You can avoid setting defaults for non zero values This could be useful for loading data from config file first and then filling the rest from env
example_test.go:462
FunctionParseAs
ParseAs parses the given struct type containing `env` tags and loads its values from environment variables.
env.go:298
FunctionParseAsWithOptions
ParseAsWithOptions parses the given struct type containing `env` tags and loads its values from environment variables.
env.go:306
FunctionTestBadSeparator
(t *testing.T)
env_test.go:865
FunctionTestBase64Password
(t *testing.T)
env_test.go:2009
FunctionTestComplePrefix
(t *testing.T)
env_test.go:1718
FunctionTestCustomParser
(t *testing.T)
env_test.go:1109
FunctionTestCustomParserBasicType
(t *testing.T)
env_test.go:1236
FunctionTestCustomParserBasicUnsupported
(t *testing.T)
env_test.go:1347
FunctionTestCustomParserError
(t *testing.T)
env_test.go:1194
FunctionTestCustomParserNotCalledForNonAlias
(t *testing.T)
env_test.go:1319
FunctionTestCustomParserUint64Alias
(t *testing.T)
env_test.go:1264
FunctionTestCustomSliceType
(t *testing.T)
env_test.go:1555
FunctionTestCustomTimeParser
(t *testing.T)
env_test.go:1580
FunctionTestEmptyOption
(t *testing.T)
env_test.go:1376
FunctionTestEmptyVars
(t *testing.T)
env_test.go:682
FunctionTestEnvBleed
(t *testing.T)
env_test.go:2426
FunctionTestErrorIs
(t *testing.T)
env_test.go:1786
FunctionTestErrorNotEmptySet
(t *testing.T)
env_test.go:956
next →1–100 of 212, ranked by callers