Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4d8d2a96
Commit
4d8d2a96
authored
Jan 03, 2019
by
Ander Arguiñano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed unixEpochFilterNano to unixEpochNanoFilter
parent
1a67a8db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
pkg/tsdb/postgres/macros.go
+1
-1
pkg/tsdb/postgres/macros_test.go
+6
-6
No files found.
pkg/tsdb/postgres/macros.go
View file @
4d8d2a96
...
...
@@ -122,7 +122,7 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
return
""
,
fmt
.
Errorf
(
"missing time column argument for macro %v"
,
name
)
}
return
fmt
.
Sprintf
(
"%s >= %d AND %s <= %d"
,
args
[
0
],
m
.
timeRange
.
GetFromAsSecondsEpoch
(),
args
[
0
],
m
.
timeRange
.
GetToAsSecondsEpoch
()),
nil
case
"__unixEpoch
FilterNano
"
:
case
"__unixEpoch
NanoFilter
"
:
if
len
(
args
)
==
0
{
return
""
,
fmt
.
Errorf
(
"missing time column argument for macro %v"
,
name
)
}
...
...
pkg/tsdb/postgres/macros_test.go
View file @
4d8d2a96
...
...
@@ -115,8 +115,8 @@ func TestMacroEngine(t *testing.T) {
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
Unix
(),
to
.
Unix
()))
})
Convey
(
"interpolate __unixEpoch
FilterNano
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
FilterNano
(time)"
)
Convey
(
"interpolate __unixEpoch
NanoFilter
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
NanoFilter
(time)"
)
So
(
err
,
ShouldBeNil
)
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
UnixNano
(),
to
.
UnixNano
()))
...
...
@@ -153,8 +153,8 @@ func TestMacroEngine(t *testing.T) {
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
Unix
(),
to
.
Unix
()))
})
Convey
(
"interpolate __unixEpoch
FilterNano
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
FilterNano
(time)"
)
Convey
(
"interpolate __unixEpoch
NanoFilter
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
NanoFilter
(time)"
)
So
(
err
,
ShouldBeNil
)
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
UnixNano
(),
to
.
UnixNano
()))
...
...
@@ -179,8 +179,8 @@ func TestMacroEngine(t *testing.T) {
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
Unix
(),
to
.
Unix
()))
})
Convey
(
"interpolate __unixEpoch
FilterNano
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
FilterNano
(time)"
)
Convey
(
"interpolate __unixEpoch
NanoFilter
function"
,
func
()
{
sql
,
err
:=
engine
.
Interpolate
(
query
,
timeRange
,
"select $__unixEpoch
NanoFilter
(time)"
)
So
(
err
,
ShouldBeNil
)
So
(
sql
,
ShouldEqual
,
fmt
.
Sprintf
(
"select time >= %d AND time <= %d"
,
from
.
UnixNano
(),
to
.
UnixNano
()))
...
...
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