Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit 3f25c6c

Browse files
committed
Fixes #130
Added 2 macros - $__timeFrom(column) -> column > '2017-04-21T05:01:17Z' - $__timeTo(column) -> column < '2017-04-21T05:01:17Z'<Paste>
1 parent 017e066 commit 3f25c6c

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

dist/module.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58979,7 +58979,12 @@ function () {
5897958979
}
5898058980

5898158981
var range = BigQueryQuery.quoteFiledName(this.target.timeColumn) + " BETWEEN " + from + " AND " + to;
58982-
return q.replace(/\$__timeFilter\(([\w_.]+)\)/g, range);
58982+
var fromRange = BigQueryQuery.quoteFiledName(this.target.timeColumn) + " > " + from + " ";
58983+
var toRange = BigQueryQuery.quoteFiledName(this.target.timeColumn) + " < " + to + " ";
58984+
q = q.replace(/\$__timeFilter\(([\w_.]+)\)/g, range);
58985+
q = q.replace(/\$__timeFrom\(([\w_.]+)\)/g, fromRange);
58986+
q = q.replace(/\$__timeTo\(([\w_.]+)\)/g, toRange);
58987+
return q;
5898358988
};
5898458989

5898558990
BigQueryQuery.prototype.replacetimeGroupAlias = function (q, alias) {

dist/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/partials/query.editor.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@
169169

170170
Macros:
171171
- $__timeFilter(column) -&gt; column BETWEEN '2017-04-21T05:01:17Z' AND '2017-04-21T05:01:17Z'
172+
- $__timeFrom(column) -&gt; column > '2017-04-21T05:01:17Z'
173+
- $__timeTo(column) -&gt; column < '2017-04-21T05:01:17Z'
172174
- $__timeGroup(column,'5m') -&gt; (extract(epoch from column)/300)::bigint*300 AS "time"
173175
- $__timeShifting(1m) -&gt; compare data from the current range to the previous range
174176

src/bigquery_query.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,20 @@ export default class BigQueryQuery {
545545
from +
546546
" AND " +
547547
to;
548-
return q.replace(/\$__timeFilter\(([\w_.]+)\)/g, range);
548+
const fromRange =
549+
BigQueryQuery.quoteFiledName(this.target.timeColumn) +
550+
" > " +
551+
from +
552+
" ";
553+
const toRange =
554+
BigQueryQuery.quoteFiledName(this.target.timeColumn) +
555+
" < " +
556+
to +
557+
" ";
558+
q = q.replace(/\$__timeFilter\(([\w_.]+)\)/g, range);
559+
q = q.replace(/\$__timeFrom\(([\w_.]+)\)/g, fromRange);
560+
q = q.replace(/\$__timeTo\(([\w_.]+)\)/g, toRange);
561+
return q;
549562
}
550563

551564
public replacetimeGroupAlias(q, alias: boolean) {

src/partials/query.editor.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@
169169

170170
Macros:
171171
- $__timeFilter(column) -&gt; column BETWEEN '2017-04-21T05:01:17Z' AND '2017-04-21T05:01:17Z'
172+
- $__timeFrom(column) -&gt; column > '2017-04-21T05:01:17Z'
173+
- $__timeTo(column) -&gt; column < '2017-04-21T05:01:17Z'
172174
- $__timeGroup(column,'5m') -&gt; (extract(epoch from column)/300)::bigint*300 AS "time"
173175
- $__timeShifting(1m) -&gt; compare data from the current range to the previous range
174176

0 commit comments

Comments
 (0)