8000 support complex map types, where the map value can be a struct · Issue #361 · caarlos0/env · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 8000
support complex map types, where the map value can be a struct #361
Open
@SkArchon

Description

@SkArchon

The proposal is to support complex map types so that we could do the following

type Test struct {
	Str string `env:"DAT_STR"`
	Num int    `env:"DAT_NUM"`
}
type ComplexConfig struct {
	Bar map[string]Test `envPrefix:"BAR_"`
}

t.Setenv("BAR_KEY1_DAT_STR", "b1t")
t.Setenv("BAR_KEY1_DAT_NUM", "201")

This is similar to #298 but for maps

The key can be any supported value (that are already present in either opts.FuncMap or the default parser list in defaultBuiltInParsers).

I will open a PR for this Issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0