Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishapi
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishapi
Commits
60fd3ce9
Commit
60fd3ce9
authored
Aug 20, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format.String() returns human-readable values.
parent
8fbbd167
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
e2e_test.go
pkg/stats/e2e_test.go
+5
-5
stats.go
pkg/stats/stats.go
+17
-3
No files found.
pkg/stats/e2e_test.go
View file @
60fd3ce9
...
...
@@ -57,11 +57,11 @@ var (
S7sUnknown
:
{
'?'
,
"unknown"
},
}
formats
=
map
[
Format
]
expRuneStr
{
Integer
:
{
'i'
,
"i"
},
Bytes
:
{
'B'
,
"
B
"
},
FormatBitmap
:
{
'b'
,
"b"
},
Duration
:
{
'd'
,
"d"
},
FormatUnknown
:
{
'?'
,
"
?
"
},
Integer
:
{
'i'
,
"i
nteger
"
},
Bytes
:
{
'B'
,
"
bytes
"
},
FormatBitmap
:
{
'b'
,
"b
itmap
"
},
Duration
:
{
'd'
,
"d
uration
"
},
FormatUnknown
:
{
'?'
,
"
unknown
"
},
}
)
...
...
pkg/stats/stats.go
View file @
60fd3ce9
...
...
@@ -114,9 +114,23 @@ const (
FormatUnknown
=
Format
(
'?'
)
)
// String returns "i", "B", "b", "d" or "?".
func
(
s
Format
)
String
()
string
{
return
string
(
s
)
// String returns "integer", "bytes", "bitmap", "duration" or
// "unknown".
func
(
f
Format
)
String
()
string
{
switch
(
f
)
{
case
Integer
:
return
"integer"
case
Bytes
:
return
"bytes"
case
FormatBitmap
:
return
"bitmap"
case
Duration
:
return
"duration"
case
FormatUnknown
:
return
"unknown"
default
:
return
"invalid status"
}
}
// XXX implement fmt.Formatter interface for Format
...
...
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