We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raw: SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time >= now() - 3h GROUP BY time(1m)
Proxy: SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time >= now() - 3h - 1d GROUP BY time(1m)
Which real need: SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time <= now() - 1d AND time >= now() - 3h - 1d GROUP BY time(1m)
FIX:
function fix_query_time_relative(q, reg, count, unit) { const match = q.match(reg); if (match) { return q.replace(match[0], match[0] + " - " + moment.duration(count, unit).valueOf() + "ms"); } else if (reg === to_rel) { const match = q.match(from_rel); if (match) { return q.replace(match[0], "time <= now()" + " - " + moment.duration(count, unit).valueOf() + "ms AND " + match[0]); } } return q; }
The text was updated successfully, but these errors were encountered:
I found this quite useful. Unless this code breaks something, maybe you can submit a pull request? :)
Sorry, something went wrong.
Fixes relative time ranges
2082b9b
maxsivanov#14
No branches or pull requests
Raw:
SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time >= now() - 3h GROUP BY time(1m)
Proxy:
SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time >= now() - 3h - 1d GROUP BY time(1m)
Which real need:
SELECT sum("col") AS "shift_1_days" FROM "m" WHERE time <= now() - 1d AND time >= now() - 3h - 1d GROUP BY time(1m)
FIX:
The text was updated successfully, but these errors were encountered: