Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
d9184077
Commit
d9184077
authored
Aug 16, 2015
by
Hepri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update templatefunc.go
parent
d4e15c0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
templatefunc.go
templatefunc.go
+27
-20
No files found.
templatefunc.go
View file @
d9184077
...
@@ -698,29 +698,36 @@ func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error) {
...
@@ -698,29 +698,36 @@ func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error) {
storedVal
:=
arg1Val
.
MapIndex
(
arg2Val
)
storedVal
:=
arg1Val
.
MapIndex
(
arg2Val
)
var
result
interface
{}
if
storedVal
.
IsValid
()
{
switch
arg1Type
.
Elem
()
.
Kind
()
{
var
result
interface
{}
case
reflect
.
Bool
:
result
=
storedVal
.
Bool
()
switch
arg1Type
.
Elem
()
.
Kind
()
{
case
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
:
case
reflect
.
Bool
:
result
=
storedVal
.
Int
()
result
=
storedVal
.
Bool
()
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
case
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
:
result
=
storedVal
.
Uint
()
result
=
storedVal
.
Int
()
case
reflect
.
Float32
,
reflect
.
Float64
:
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
result
=
storedVal
.
Float
()
result
=
storedVal
.
Uint
()
case
reflect
.
String
:
case
reflect
.
Float32
,
reflect
.
Float64
:
result
=
storedVal
.
String
()
result
=
storedVal
.
Float
()
default
:
case
reflect
.
String
:
result
=
storedVal
.
Interface
()
result
=
storedVal
.
String
()
}
default
:
result
=
storedVal
.
Interface
()
}
// if there is more keys, handle this recursively
// if there is more keys, handle this recursively
if
len
(
arg2
)
>
1
{
if
len
(
arg2
)
>
1
{
return
MapGet
(
result
,
arg2
[
1
:
]
...
)
return
MapGet
(
result
,
arg2
[
1
:
]
...
)
}
else
{
return
result
,
nil
}
}
else
{
}
else
{
return
result
,
nil
return
nil
,
nil
}
}
}
else
{
}
else
{
return
nil
,
nil
return
nil
,
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment