Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5c1e8e42
authored
2014-10-09 17:07:28 -0400
by
Bill Davis
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Reworked implementation to not return encoded json
1 parent
ca3e7568
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
toolbox/statistics.go
toolbox/statistics_test.go
toolbox/statistics.go
View file @
5c1e8e4
...
...
@@ -15,7 +15,6 @@
package
toolbox
import
(
"encoding/json"
"fmt"
"sync"
"time"
...
...
@@ -112,11 +111,7 @@ func (m *UrlMap) GetMap() map[string]interface{} {
return
content
}
func
(
m
*
UrlMap
)
GetMapJSON
()
([]
byte
,
error
)
{
return
json
.
Marshal
(
m
)
}
func
(
m
UrlMap
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
m
*
UrlMap
)
GetMapData
()
[]
map
[
string
]
interface
{}
{
resultLists
:=
make
([]
map
[
string
]
interface
{},
0
)
...
...
@@ -134,7 +129,7 @@ func (m UrlMap) MarshalJSON() ([]byte, error) {
resultLists
=
append
(
resultLists
,
result
)
}
}
return
json
.
Marshal
(
resultLists
)
return
resultLists
}
// global statistics data map
...
...
toolbox/statistics_test.go
View file @
5c1e8e4
...
...
@@ -15,6 +15,7 @@
package
toolbox
import
(
"encoding/json"
"testing"
"time"
)
...
...
@@ -29,9 +30,11 @@ func TestStatics(t *testing.T) {
StatisticsMap
.
AddStatistics
(
"DELETE"
,
"/api/user"
,
"&admin.user"
,
time
.
Duration
(
1400
))
t
.
Log
(
StatisticsMap
.
GetMap
())
jsonString
,
err
:=
StatisticsMap
.
GetMapJSON
()
data
:=
StatisticsMap
.
GetMapData
()
b
,
err
:=
json
.
Marshal
(
data
)
if
err
!=
nil
{
t
.
Errorf
(
err
.
Error
())
}
t
.
Log
(
string
(
jsonString
))
t
.
Log
(
string
(
b
))
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment