Documentation
¶
Index ¶
- func ParseBoolEnv(envKey string, defaultValue bool) (bool, error)
- func ParseDuration(s string) (time.Duration, error)
- func ParseDurationEnv(envKey string, defaultDuration time.Duration) (time.Duration, error)
- func ParseDurationEnvOptions(envKey string, defaultDuration time.Duration, opts DurationOptions) (time.Duration, error)
- func ParseDurationOptions(s string, opts DurationOptions) (time.Duration, error)
- func ParseList(s, sep string) []string
- func ParseListEnv(envKey, sep string, defaultValue []string) []string
- func ParseWildcardPattern(p string) *wildcard.Matcher
- func ParseWildcardPatterns(s string) wildcard.Matchers
- func ParseWildcardPatternsEnv(envKey string, defaultValue wildcard.Matchers) wildcard.Matchers
- type DurationOptions
- type Size
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBoolEnv ¶
ParseBoolEnv gets the value of the environment variable envKey and, if set, parses it as a boolean. If the environment variable is unset, defaultValue is returned.
func ParseDuration ¶
ParseDuration parses s as a duration, accepting a subset of the syntax supported by time.ParseDuration.
Valid time units are "ms", "s", "m".
func ParseDurationEnv ¶
ParseDurationEnv gets the value of the environment variable envKey and, if set, parses it as a duration. If the environment variable is unset, defaultDuration is returned.
func ParseDurationEnvOptions ¶
func ParseDurationEnvOptions(envKey string, defaultDuration time.Duration, opts DurationOptions) (time.Duration, error)
ParseDurationEnvOptions gets the value of the environment variable envKey and, if set, parses it as a duration. If the environment variable is unset, defaultDuration is returned.
func ParseDurationOptions ¶
func ParseDurationOptions(s string, opts DurationOptions) (time.Duration, error)
ParseDurationOptions parses s as a duration, accepting a subset of the syntax supported by time.ParseDuration. It allows a DurationOptions to be passed to specify the minimum time.Duration unit allowed.
Valid time units are "us", "ms", "s", "m".
func ParseList ¶
ParseList parses s as a list of strings, separated by sep, and with whitespace trimmed from the list items, omitting empty items.
func ParseListEnv ¶
ParseListEnv gets the value of the environment variable envKey and, if set, parses it as a list separated by sep. If the environment variable is unset, defaultValue is returned.
func ParseWildcardPattern ¶
ParseWildcardPattern parses p as a wildcard pattern, returning a wildcard.Matcher.
Patterns support the "*" wildcard, which will match zero or more characters. A prefix of (?-i) treats the pattern case-sensitively, while a prefix of (?i) treats the pattern case-insensitively (the default). All other characters in the pattern are matched exactly.
func ParseWildcardPatterns ¶
ParseWildcardPatterns parses s as a comma-separated list of wildcard patterns, and returns wildcard.Matchers for each.
Patterns support the "*" wildcard, which will match zero or more characters. A prefix of (?-i) treats the pattern case-sensitively, while a prefix of (?i) treats the pattern case-insensitively (the default). All other characters in the pattern are matched exactly.
func ParseWildcardPatternsEnv ¶
ParseWildcardPatternsEnv gets the value of the environment variable envKey and, if set, parses it as a list of wildcard patterns. If the environment variable is unset, defaultValue is returned.
Types ¶
type DurationOptions ¶
DurationOptions can be used to specify the minimum accepted duration unit for ParseDurationOptions.
type Size ¶
type Size int64
Size represents a size in bytes.
Common power-of-two sizes.
func ParseSize ¶
ParseSize parses s as a size, in bytes.
Valid size units are "b", "kb", "mb", "gb".
func ParseSizeEnv ¶
ParseSizeEnv gets the value of the environment variable envKey and, if set, parses it as a size. If the environment variable is unset, defaultSize is returned.