mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Re-write CH queries to use query params.
This commit is contained in:
parent
b4bd988e4e
commit
1eb9e10d94
12 changed files with 81 additions and 100 deletions
|
|
@ -28,14 +28,14 @@ async function relationalQuery(websiteId: string) {
|
|||
}
|
||||
|
||||
async function clickhouseQuery(websiteId: string) {
|
||||
const { rawQuery, getDateFormat } = clickhouse;
|
||||
const params = [websiteId];
|
||||
const { rawQuery } = clickhouse;
|
||||
const params = { websiteId, startAt: subMinutes(new Date(), 5) };
|
||||
|
||||
return rawQuery(
|
||||
`select count(distinct session_id) x
|
||||
from event
|
||||
where website_id = $1
|
||||
and created_at >= ${getDateFormat(subMinutes(new Date(), 5))}`,
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at >= {startAt:DateTime('UTC')}`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue