From 220c71d80a0773f3fe608a6139e5f75dff415d02 Mon Sep 17 00:00:00 2001 From: Tequila Date: Tue, 18 Jun 2013 11:21:13 +0800 Subject: [PATCH] add GetMap --- config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.go b/config.go index 6180ebd..ffa1c74 100644 --- a/config.go +++ b/config.go @@ -126,3 +126,12 @@ func (c *Config) GetArray(key string) []interface{} { } return result.([]interface{}) } + +// Returns an map for the config variable key +func (c *Config) GetMap(key string) map[string]interface{} { + result, present := c.data[key] + if !present { + return map[string]interface{}(nil) + } + return result.(map[string]interface{}) +}