From 9badf9a54a3468409ebcf78d7638cf2aba73e43a Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Sat, 2 Apr 2022 13:15:55 +0200 Subject: [PATCH] add 5 dimensional map --- envconf.go | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/envconf.go b/envconf.go index 0749797..00127b5 100644 --- a/envconf.go +++ b/envconf.go @@ -783,6 +783,106 @@ func (c *Config) GetMapMapMapMapHex(key string) (retval map[string]map[string]ma return } +func (c *Config) GetMapMapMapMapMapInt(key string) (retval map[string]map[string]map[string]map[string]map[string]int64) { + retval = make(map[string]map[string]map[string]map[string]map[string]int64) + for k1, v1 := range c.getRawMapMapMapMapMap(key, TypeInt) { + retval[k1] = make(map[string]map[string]map[string]map[string]int64) + for k2, v2 := range v1 { + retval[k1][k2] = make(map[string]map[string]map[string]int64) + for k3, v3 := range v2 { + retval[k1][k2][k3] = make(map[string]map[string]int64) + for k4, v4 := range v3 { + retval[k1][k2][k3][k4] = make(map[string]int64) + for k5, v5 := range v4 { + retval[k1][k2][k3][k4][k5] = v5.intval + } + } + } + } + } + return +} + +func (c *Config) GetMapMapMapMapMapDuration(key string) (retval map[string]map[string]map[string]map[string]map[string]time.Duration) { + retval = make(map[string]map[string]map[string]map[string]map[string]time.Duration) + for k1, v1 := range c.getRawMapMapMapMapMap(key, TypeDuration) { + retval[k1] = make(map[string]map[string]map[string]map[string]time.Duration) + for k2, v2 := range v1 { + retval[k1][k2] = make(map[string]map[string]map[string]time.Duration) + for k3, v3 := range v2 { + retval[k1][k2][k3] = make(map[string]map[string]time.Duration) + for k4, v4 := range v3 { + retval[k1][k2][k3][k4] = make(map[string]time.Duration) + for k5, v5 := range v4 { + retval[k1][k2][k3][k4][k5] = v5.durval + } + } + } + } + } + return +} + +func (c *Config) GetMapMapMapMapMapString(key string) (retval map[string]map[string]map[string]map[string]map[string]string) { + retval = make(map[string]map[string]map[string]map[string]map[string]string) + for k1, v1 := range c.getRawMapMapMapMapMap(key, TypeString) { + retval[k1] = make(map[string]map[string]map[string]map[string]string) + for k2, v2 := range v1 { + retval[k1][k2] = make(map[string]map[string]map[string]string) + for k3, v3 := range v2 { + retval[k1][k2][k3] = make(map[string]map[string]string) + for k4, v4 := range v3 { + retval[k1][k2][k3][k4] = make(map[string]string) + for k5, v5 := range v4 { + retval[k1][k2][k3][k4][k5] = v5.strval + } + } + } + } + } + return +} + +func (c *Config) GetMapMapMapMapMapBool(key string) (retval map[string]map[string]map[string]map[string]map[string]bool) { + retval = make(map[string]map[string]map[string]map[string]map[string]bool) + for k1, v1 := range c.getRawMapMapMapMapMap(key, TypeBool) { + retval[k1] = make(map[string]map[string]map[string]map[string]bool) + for k2, v2 := range v1 { + retval[k1][k2] = make(map[string]map[string]map[string]bool) + for k3, v3 := range v2 { + retval[k1][k2][k3] = make(map[string]map[string]bool) + for k4, v4 := range v3 { + retval[k1][k2][k3][k4] = make(map[string]bool) + for k5, v5 := range v4 { + retval[k1][k2][k3][k4][k5] = v5.boolval + } + } + } + } + } + return +} + +func (c *Config) GetMapMapMapMapMapHex(key string) (retval map[string]map[string]map[string]map[string]map[string][]byte) { + retval = make(map[string]map[string]map[string]map[string]map[string][]byte) + for k1, v1 := range c.getRawMapMapMapMapMap(key, TypeHex) { + retval[k1] = make(map[string]map[string]map[string]map[string][]byte) + for k2, v2 := range v1 { + retval[k1][k2] = make(map[string]map[string]map[string][]byte) + for k3, v3 := range v2 { + retval[k1][k2][k3] = make(map[string]map[string][]byte) + for k4, v4 := range v3 { + retval[k1][k2][k3][k4] = make(map[string][]byte) + for k5, v5 := range v4 { + retval[k1][k2][k3][k4][k5] = v5.binval + } + } + } + } + } + return +} + func getFirstRune(str string) rune { for _, v := range str { return v