Documentation
¶
Overview ¶
Package iutils provides specific helpers for internal use.
Code generated by "string-enumer -t Format -o format_enumer___generated.go ."; DO NOT EDIT.
Index ¶
- Variables
- func Any[T comparable](args ...T) T
- func LoadDotEnv(path file.File) (env.Env, error)
- func MatchEnvToFlag(name Prefix) func(string) string
- func Merge[T any](dst, src *T, opts ...func(*mergo.Config)) (err error)
- func Print(format Format, cfg ...any)
- func ReadPaths(paths ...string) ([]byte, error)
- func ReadPathsOrDefault(defaultPath string, args ...string) ([]byte, error)
- func SplitTags(tagList []string) tags.IncludeTags
- func StructToKoanf(s any) (*koanfx.Koanf, error)
- type BytesSource
- type FileSource
- type Format
- type MultiSource
- type Prefix
- type Source
- type StdinSource
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSource = errors.New("invalid source")
ErrInvalidSource is returned when the source is invalid.
Functions ¶
func Any ¶
func Any[T comparable](args ...T) T
Any returns the first non-zero value from the provided arguments.
func LoadDotEnv ¶
LoadDotEnv loads environment variables from a .env file.
func MatchEnvToFlag ¶
MatchEnvToFlag allows the env provider of koanf to property match stuff like: APP_REGISTRY_TOKEN -> registry-token when name is for example "APP_".
func Merge ¶
Merge merges the source and destination values. It uses the mergo package to perform the merge. The destination value is modified in place. The source value is deep-copied to avoid modifying the original. The function accepts options for the merge operation. If no options are provided, it uses the default options: mergo.WithOverride and mergo.WithoutDereference.
func ReadPaths ¶
ReadPaths reads from one or more file paths or "-" (stdin), and returns concatenated data.
func ReadPathsOrDefault ¶
ReadPathsOrDefault reads from args if provided, or from defaultPath if args is empty.
func SplitTags ¶
func SplitTags(tagList []string) tags.IncludeTags
SplitTags splits tags into include and exclude lists.
Types ¶
type FileSource ¶
FileSource reads from a file.
type Format ¶
type Format string
Format represents the output format for displaying configuration.
func FormatValues ¶
func FormatValues() []Format
FormatValues returns a list of all (valid) Format values
type MultiSource ¶
type MultiSource struct {
Sources []Source
}
MultiSource reads from multiple sources and concatenates the results.
func NewMultiSource ¶
func NewMultiSource(sources ...Source) *MultiSource
NewMultiSource creates a new multi source.
type Prefix ¶
type Prefix string
Prefix represents a prefix string used for configuration keys.
func (Prefix) RemovePrefix ¶
RemovePrefix removes the specified prefix from the prefix string.
func (Prefix) RemoveSuffix ¶
RemoveSuffix removes the specified suffix from the prefix string.
func (Prefix) WithUnderscores ¶
WithUnderscores replaces dots with underscores in the prefix string.
type Source ¶
Source represents a source of input data.
func GetSourceFromPath ¶
GetSourceFromPath determines the appropriate source type for a given path.