mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 20:00:54 +00:00
Merge pull request #3263 from guomao545/master
Support return middle level value
This commit is contained in:
commit
42c394e28b
@ -290,12 +290,15 @@ func (c *ConfigContainer) getData(key string) (interface{}, error) {
|
|||||||
|
|
||||||
keys := strings.Split(key, ".")
|
keys := strings.Split(key, ".")
|
||||||
tmpData := c.data
|
tmpData := c.data
|
||||||
for _, k := range keys {
|
for idx, k := range keys {
|
||||||
if v, ok := tmpData[k]; ok {
|
if v, ok := tmpData[k]; ok {
|
||||||
switch v.(type) {
|
switch v.(type) {
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
{
|
{
|
||||||
tmpData = v.(map[string]interface{})
|
tmpData = v.(map[string]interface{})
|
||||||
|
if idx == len(keys) - 1 {
|
||||||
|
return tmpData, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user